コード例 #1
0
/*
 *  void OnCollisionStay(Collision coll)
 *  {
 *      //if you collide with a solid object, change direction
 *      switch (coll.gameObject.tag)
 *      {
 *          case "Static":
 *
 *          case "Locked":
 *              target = 1.0f;
 *              current_dir = change_direction(current_dir);
 *              break;
 *          default:
 *              break;
 *      }
 *  }
 */
    void OnTriggerEnter(Collider coll)
    {
        switch (coll.gameObject.tag)
        {
        case "Bounds":
            print("bounds encounter");
//                target = 1.0f;
//                current_dir = change_direction(current_dir);
            break;

        case "Boomerang":
            stun = 2.5f;
            break;

        case "PlayerProjectile":
            health -= 1;
            if (health <= 0)
            {
                Loot_drops.drop_item(rupee, heart, bomb, this.gameObject.transform.position);
                Destroy(this.gameObject);
            }
            break;

        case "Static":

        case "Locked":
//                target = 1.0f;
//                current_dir = change_direction(current_dir);
            break;

        default:
            break;
        }
    }
コード例 #2
0
ファイル: Wallmaster.cs プロジェクト: haasjac/Zelda
    void OnTriggerEnter(Collider coll)
    {
        switch (coll.gameObject.tag)
        {
        case "Player":
            //move link and camera back to start
            Vector3 pos = new Vector3(x, y, -10);
            cam.transform.position = pos;
            pos.z = 0;
            link.transform.position = pos;
            break;

        case "PlayerProjectile":
            health -= 1;
            if (health <= 0)
            {
                Loot_drops.drop_item(rupee, heart, bomb, this.gameObject.transform.position);
                Destroy(this.gameObject);
            }
            else
            {
                Flee();
            }
            break;

        case "Boomerang":
            stun = 2.5f;
            break;
        }
    }
コード例 #3
0
 void OnTriggerEnter(Collider coll)
 {
     switch (coll.gameObject.tag)
     {
     case "Boomerang":
     case "PlayerProjectile":
         health -= 1;
         if (health <= 0)
         {
             Loot_drops.drop_item(rupee, heart, bomb, this.gameObject.transform.position);
             Destroy(this.gameObject);
         }
         break;
     }
 }
コード例 #4
0
ファイル: Keese.cs プロジェクト: haasjac/Zelda
    void OnTriggerEnter(Collider coll)
    {
        switch (coll.gameObject.tag)
        {
        case "Bounds":
            //reverse direction
            distance += 0.5f;
            print("bounds encounter");
            if (horizontal == Direction.EAST)
            {
                horizontal = Direction.WEST;
            }
            else if (horizontal == Direction.WEST)
            {
                horizontal = Direction.EAST;
            }

            if (vertical == Direction.NORTH)
            {
                vertical = Direction.SOUTH;
            }
            else if (vertical == Direction.SOUTH)
            {
                vertical = Direction.NORTH;
            }
            break;

        case "Boomerang":
        case "PlayerProjectile":
            health -= 1;
            if (health <= 0)
            {
                Loot_drops.drop_item(rupee, heart, bomb, this.gameObject.transform.position);
                Destroy(this.gameObject);
            }
            break;
        }
    }