示例#1
0
 /// <summary>
 /// Replace the powerup elsewhere.
 /// </summary>
 private void Respawn()
 {
     // Move up to root level
     transform.parent   = transform.parent.parent;
     transform.rotation = Quaternion.identity;
     transform.position = SpawnController.FindFreeLocation(4);
     EnablePickup(true);
 }
示例#2
0
    /// <summary>
    /// Go boom and respawn
    /// </summary>
    /// <param name="other">Object that entered the area</param>
    internal void OnTriggerEnter2D(Collider2D other)
    {
        GetComponent <AudioSource>().Play();
        ScoreManager.IncreaseScore(other.gameObject, -20);
        Instantiate(ExplosionPrefab, transform.position, Quaternion.identity);

        // Respawn
        transform.position = SpawnController.FindFreeLocation(2);
    }
示例#3
0
    /// <summary>
    /// Run toward the goal
    /// </summary>
    /// <param name="tank">Tank being controlled</param>
    /// <returns>True if behavior wants to keep running</returns>
    public override bool Tick(AITankControl tank)
    {
        while (WallBetween(tank.transform.position, goal))
        {
            goal = SpawnController.FindFreeLocation(1);
        }

        if (Vector3.Distance(goal, tank.transform.position) > 1)
        {
            tank.MoveTowards(goal);
            return(true);
        }

        else
        {
            return(false);
        }
    }
示例#4
0
 /// <summary>
 /// Teleport the player
 /// </summary>
 public override void Fire()
 {
     transform.parent.GetComponent <Rigidbody2D>().MovePosition(SpawnController.FindFreeLocation(2));
     PowerUpDone();
 }