/// <summary> /// Update the Falling Platform Position /// </summary> /// <param name="gameTime">Current Game Time</param> public override void Update(GameTime gameTime) { //If we've triggered the fall if (triggerFall && !hasFallen) { //Increment the fall counter if ((fallCounter += (float)gameTime.ElapsedGameTime.TotalSeconds) > FallCounterMax) { //Fall hasFallen = true; IsIgnoringGravity = false; IsStaticVertical = false; for (int i = 0; i < ConnectedWaypoints.Count; i++) { ConnectedWaypoints[i].IsActive = false; } if (EnemyReference != null) { EnemyReference.InvalidatePath(); } } else { //Shake float xChange = (float)Math.Sin(gameTime.TotalGameTime.TotalSeconds * shakeSpeed) * shakeScale; Position = new Vector2(Position.X + xChange, Position.Y); } } base.Update(gameTime); }
void Start() { ef = GetComponent <EnemyReference>(); el = GameObject.Find("Enemies Left").GetComponent <EnemiesLeft>(); enemies = new List <GameObject>(); }
// Use this for initialization void Start() { r = new EnemyReference(gameObject); mov = GetComponentInParent <EnemyMovement> (); }