public GameObject SpawnObject() { Debug.Log("Oh my, Spawning Time already?"); System.Random rand = new System.Random(); RoadLane lane = (RoadLane)rand.Next(0, 3); GameObject spawnedObject = SpawnObject(lane); return(spawnedObject); }
private void createLanes() { for (var i = 0; i < LaneSettings.RoadNumberOfVehicles.Length; i++) { var lane = new RoadLane(LaneSettings.RoadDirections[i], LaneSettings.RoadVehicleTypes[i], LaneSettings.RoadNumberOfVehicles[i], LaneSettings.RoadSpeeds[i], this.calculateNextLaneYLocation()); this.lanes.Add(lane); } }
public GameObject SpawnObject(RoadLane lanePosition) { Debug.Log("Spawn that thing."); GameObject SpawnedObject = ObjectPool.GetNextObject(ObjectPoolTypes.StaticObject); SpawnedObject.transform.position = new Vector3(RoadStartDistance, -10, 0); StaticObjectBehaviourScript objectScript = SpawnedObject.GetComponent <StaticObjectBehaviourScript>(); objectScript.lanePosition = lanePosition; return(SpawnedObject); }
public void recievedInput(SwipeDirection direction) { switch (direction) { case SwipeDirection.UP: if (ducking) { ducking = false; } else { if (!inJump) { inJump = true; jumpTimer = maxJumpTime; } } break; case SwipeDirection.RIGHT: currentPlayerLane++; break; case SwipeDirection.DOWN: if (inJump) { inJump = false; } else { if (!ducking) { ducking = true; duckTimer = maxDuckTime; } } break; case SwipeDirection.LEFT: currentPlayerLane--; break; } if ((int)currentPlayerLane > 2) { currentPlayerLane = RoadLane.RIGHT; } if ((int)currentPlayerLane < 0) { currentPlayerLane = RoadLane.LEFT; } }
// Use this for initialization void Start() { currentPlayerLane = RoadLane.MIDDLE; transform.position = new Vector3(0, 0.75f, 0); inJump = false; jumpTimer = 0.0f; maxJumpTime = 0.8f; ducking = false; duckTimer = 0.0f; maxDuckTime = 0.8f; }
void MoveToLane() { float xPos, yPos, zPos; xPos = 0; yPos = 0.75f; zPos = transform.position.z; if (inJump) { yPos = 1.75f; } else if (ducking) { yPos = 0.25f; } if (previousPlayerLane != currentPlayerLane) { switch (currentPlayerLane) { case RoadLane.LEFT: zPos = -1.5f; break; case RoadLane.MIDDLE: zPos = 0; break; case RoadLane.RIGHT: zPos = 1.5f; break; } previousPlayerLane = currentPlayerLane; } transform.position = new Vector3(xPos, yPos, zPos); }
public override void VisitUpdate(RoadLane roadLane) { System.Windows.Forms.MessageBox.Show("DecelerateRule Updated"); }