public Koopa(Vector2 position) { State = new KoopaMovingState(this); EnemyPhysics = new EnemyPhysics(position); Collidable = true; Flipped = false; }
void Start() { if (transform.name != "Enemy") { enemyPhysics = GetComponent <EnemyPhysics>(); currentWaitTime = 0; seen = false; int pointAIndex; int pointBIndex; if (routesTaken < 4) { pointAIndex = routesTaken; pointBIndex = pointAIndex + 1; if (pointBIndex > sideMoveSpots.Length - 1) { pointBIndex = 0; } pointA = sideMoveSpots[pointAIndex].position; pointB = sideMoveSpots[pointBIndex].position; routesTaken++; } else if (routesTaken >= 4 && routesTaken < 8) { pointAIndex = routesTaken - 4; pointBIndex = pointAIndex + 1; if (pointBIndex > diagMoveSpots.Length - 1) { pointBIndex = 0; } pointA = diagMoveSpots[pointAIndex].position; pointB = diagMoveSpots[pointBIndex].position; routesTaken++; } else { pointA = new Vector3(Random.Range(100, 1400), Random.Range(100, 1400), -24); pointB = new Vector3(Random.Range(100, 1400), Random.Range(100, 1400), -24); } enemy.transform.position = pointA; fromPointA = true; } }
public void Update(GameTime gametime) { if (State is KoopaFlippedState) { deathTimer++; } if (State is KoopaStompedKickedState) { kickTimer++; } if (State is KoopaStompedState) { reviveTimer++; } else { reviveTimer = Util.Instance.Koopa_revivetimer_update; } if (reviveTimer == Util.Instance.Koopa_update_ref250) { Revive(); } if (deathTimer == Util.Instance.Koopa_update_ref100) { shouldDraw = false; deathTimer = Util.Instance.Koopa_deathtimer_update_100case; } else { State.Update(gametime); EnemyPhysics.Update(gametime); EnemyPhysics.EnemyMove(); } }
void Start() { direction = speed = Vector2.zero; physics = GetComponent <EnemyPhysics>(); }