picking up and delivering pizzas to random places

master
Jordan Orelli 5 years ago
parent 80170fb994
commit e508d46a75

@ -45,6 +45,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 012413c5e592c4946a4264199a3b69ed, type: 3} m_Script: {fileID: 11500000, guid: 012413c5e592c4946a4264199a3b69ed, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Address:
Directions:
visualModel: {fileID: 3024510022206096755}
--- !u!65 &3024510022063183908 --- !u!65 &3024510022063183908
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -69,6 +72,10 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: arrow-down value: arrow-down
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 6e4f77a665540bc4ba855f18646c79aa, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 6e4f77a665540bc4ba855f18646c79aa, type: 3} - target: {fileID: 400000, guid: 6e4f77a665540bc4ba855f18646c79aa, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 0 value: 0
@ -117,8 +124,22 @@ PrefabInstance:
propertyPath: m_Materials.Array.data[0] propertyPath: m_Materials.Array.data[0]
value: value:
objectReference: {fileID: 2100000, guid: 65a69707ffcbca34aab8ecb17add69fb, type: 2} objectReference: {fileID: 2100000, guid: 65a69707ffcbca34aab8ecb17add69fb, type: 2}
- target: {fileID: 2300000, guid: 6e4f77a665540bc4ba855f18646c79aa, type: 3}
propertyPath: m_CastShadows
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2300000, guid: 6e4f77a665540bc4ba855f18646c79aa, type: 3}
propertyPath: m_ReceiveShadows
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6e4f77a665540bc4ba855f18646c79aa, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 6e4f77a665540bc4ba855f18646c79aa, type: 3}
--- !u!1 &3024510022206096755 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100000, guid: 6e4f77a665540bc4ba855f18646c79aa,
type: 3}
m_PrefabInstance: {fileID: 3024510022206194643}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3024510022206069075 stripped --- !u!4 &3024510022206069075 stripped
Transform: Transform:
m_CorrespondingSourceObject: {fileID: 400000, guid: 6e4f77a665540bc4ba855f18646c79aa, m_CorrespondingSourceObject: {fileID: 400000, guid: 6e4f77a665540bc4ba855f18646c79aa,

@ -0,0 +1,145 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3896358017091198794
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1045971353998696840}
- component: {fileID: 3106620090204651546}
m_Layer: 0
m_Name: Pizzeria
m_TagString: Pizzeria
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1045971353998696840
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3896358017091198794}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 40, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3426617804528095592}
- {fileID: 2960413628790942665}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3106620090204651546
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3896358017091198794}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b6f7938b79611548bfe816b138c8226, type: 3}
m_Name:
m_EditorClassIdentifier:
destinations:
- {fileID: 0}
- {fileID: 0}
pizzaPrefab: {fileID: 5382810440125270896, guid: b6ec5e00026070f4788838f2d2bef56c,
type: 3}
--- !u!1 &4271078305772633658
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2960413628790942665}
m_Layer: 0
m_Name: SpawnPoint
m_TagString: PizzaSpawnPoint
m_Icon: {fileID: 1206586993520771344, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2960413628790942665
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4271078305772633658}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5, y: 1, z: 8}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1045971353998696840}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &3426617804527963116
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1045971353998696840}
m_Modifications:
- target: {fileID: 100004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_Name
value: pizza-hut
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4873b2343625b0547ae8f91b1707a68c, type: 3}
--- !u!4 &3426617804528095592 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400004, guid: 4873b2343625b0547ae8f91b1707a68c,
type: 3}
m_PrefabInstance: {fileID: 3426617804527963116}
m_PrefabAsset: {fileID: 0}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 32a72bcc205a2c643b605aa141be369b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 4217495058645254511} - component: {fileID: 4217495058645254511}
- component: {fileID: 6956701330587504882} - component: {fileID: 6956701330587504882}
- component: {fileID: 2954567574914083179} - component: {fileID: 2954567574914083179}
- component: {fileID: 114787737091386174}
m_Layer: 0 m_Layer: 0
m_Name: Straight Road m_Name: Straight Road
m_TagString: Untagged m_TagString: Untagged
@ -73,6 +74,18 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 20, y: 3, z: 2} m_Size: {x: 20, y: 3, z: 2}
m_Center: {x: 0, y: 1.5, z: -4} m_Center: {x: 0, y: 1.5, z: -4}
--- !u!114 &114787737091386174
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4352836557107626428}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eb33c7c4902fb084b9a4312616f1285b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &4692730903129939174 --- !u!1001 &4692730903129939174
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

@ -4,14 +4,17 @@ using UnityEngine;
public class DestinationController : MonoBehaviour public class DestinationController : MonoBehaviour
{ {
public string Address;
public string Directions;
public GameObject visualModel;
private float period; private float period;
// private float phase; // private float phase;
private Vector3 startPosition; private Vector3 startPosition;
private float startTime; private float startTime;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start() {
{
period = 3.0f; period = 3.0f;
// phase = 0f; // phase = 0f;
startPosition = transform.position; startPosition = transform.position;
@ -19,11 +22,11 @@ public class DestinationController : MonoBehaviour
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update() {
{
float elapsedTime = Time.time - startTime; float elapsedTime = Time.time - startTime;
float phase = (elapsedTime % period) / period; float phase = (elapsedTime % period) / period;
phase = phase * 2.0f * Mathf.PI; phase = phase * 2.0f * Mathf.PI;
transform.position = startPosition + (Mathf.Sin(phase) * Vector3.up * 0.5f); transform.position = startPosition + (Mathf.Sin(phase) * Vector3.up * 0.5f);
} }
} }

@ -4,6 +4,8 @@ using UnityEngine;
public class PizzaController : MonoBehaviour public class PizzaController : MonoBehaviour
{ {
public GameObject destination;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -15,4 +17,9 @@ public class PizzaController : MonoBehaviour
{ {
transform.Rotate(new Vector3(15, 30, 45) * Time.deltaTime); transform.Rotate(new Vector3(15, 30, 45) * Time.deltaTime);
} }
public void pickup() {
destination.SetActive(true);
Destroy(this.gameObject);
}
} }

@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PizzeriaController : MonoBehaviour
{
public GameObject[] destinations;
public GameObject pizzaPrefab;
private GameObject spawnPoint;
public void MakeAPizza() {
if (spawnPoint == null) {
foreach (Transform child in transform) {
if (child.CompareTag("PizzaSpawnPoint")) {
spawnPoint = child.gameObject;
}
}
}
PizzaController pizza = Instantiate(pizzaPrefab, spawnPoint.transform.position, Quaternion.identity).GetComponent<PizzaController>();
GameObject obj = destinations[Random.Range(0, destinations.Length)];
pizza.destination = obj;
Debug.Log(pizza);
}
// Start is called before the first frame update
void Start() {
foreach (Transform child in transform) {
if (child.CompareTag("PizzaSpawnPoint")) {
spawnPoint = child.gameObject;
}
}
foreach (GameObject obj in destinations) {
obj.SetActive(false);
}
}
// Update is called once per frame
void Update() {
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6b6f7938b79611548bfe816b138c8226
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -11,10 +11,14 @@ public class PlayerController : MonoBehaviour
private bool hasPizza; private bool hasPizza;
public int score; public int score;
private PizzeriaController pizzeria;
// Start is called before the first frame update // Start is called before the first frame update
void Start() { void Start() {
hasPizza = false; hasPizza = false;
score = 0; score = 0;
pizzeria = GameObject.FindGameObjectWithTag("Pizzeria").GetComponent<PizzeriaController>();
pizzeria.MakeAPizza();
} }
void FixedUpdate() { void FixedUpdate() {
@ -42,15 +46,17 @@ public class PlayerController : MonoBehaviour
Debug.Log(other); Debug.Log(other);
if (other.gameObject.CompareTag("Pizza")) { if (other.gameObject.CompareTag("Pizza")) {
hasPizza = true; hasPizza = true;
Destroy(other.gameObject); other.GetComponent<PizzaController>().pickup();
return; return;
} }
if (other.gameObject.CompareTag("Destination")) { if (other.gameObject.CompareTag("Destination")) {
if (hasPizza) { if (hasPizza) {
Destroy(other.gameObject); DestinationController dest = other.GetComponent<DestinationController>();
other.gameObject.SetActive(false);
hasPizza = false; hasPizza = false;
score++; score++;
pizzeria.MakeAPizza();
return; return;
} }
} }

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RoadController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb33c7c4902fb084b9a4312616f1285b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -8,6 +8,8 @@ TagManager:
- PizzaIndicator - PizzaIndicator
- Pizza - Pizza
- Destination - Destination
- Pizzeria
- PizzaSpawnPoint
layers: layers:
- Default - Default
- TransparentFX - TransparentFX
@ -18,7 +20,7 @@ TagManager:
- -
- -
- PostProcessing - PostProcessing
- - Unselectable
- -
- -
- -

Loading…
Cancel
Save