Esempio n. 1
0
    void Update()
    {
        //constant move down
        transform.Translate(Vector2.down * Time.deltaTime * moveSpeed);

        intPos = IntPosition2D.Vector2ToIntPos2D(transform.position);

        if (intPos != lastIntPos)
        {
            bombDroped = false;
        }

        if (intPos.Y == 23)
        {
            lastIntPos = intPos;
        }

        if (!bombDroped && intPos.Y == (lastIntPos.Y - 1))
        {
            FireMissile();


            lastIntPos = intPos;
            bombDroped = true;
        }

        if (transform.position.y <= -5)
        {
            DestroyImmediate(this.gameObject);
        }
    }
Esempio n. 2
0
 public Player(World _World)
 {
     world  = _World;
     pos    = world.Tiles [0, 0].TilePos;
     intPos = new IntPosition2D(0, 0);
     intPos = IntPosition2D.Vector2ToIntPos2D(pos);
 }
Esempio n. 3
0
 public void MoveDown()
 {
     try
     {
         if (world.Tiles [intPos.X, intPos.Y - 1].Walkable)
         {
             pos    = new Vector2(intPos.X, intPos.Y - 1);
             intPos = IntPosition2D.Vector2ToIntPos2D(pos);
         }
         else if (!world.Tiles [intPos.X, intPos.Y - 1].Walkable)
         {
         }
     } catch
     {
     }
 }
Esempio n. 4
0
 public void MoveLeft()
 {
     try
     {
         if (world.Tiles [intPos.X - 1, intPos.Y].Walkable)
         {
             pos    = new Vector2(intPos.X - 1, intPos.Y);
             intPos = IntPosition2D.Vector2ToIntPos2D(pos);
         }
         else if (!world.Tiles [intPos.X - 1, intPos.Y].Walkable)
         {
             //Debug.Log ("could not move to the left");
         }
     } catch
     {
         //Debug.Log ("could not move to the left");
     }
 }
Esempio n. 5
0
    void Update()
    {           //constant move down
        transform.Translate(Vector2.down * Time.deltaTime * moveSpeed);

        intPos = IntPosition2D.Vector2ToIntPos2D(transform.position);


        //makes sure a bomb is dropped in every tile

        if (intPos != lastIntPos)
        {
            bombDroped = false;
        }

        if (intPos.Y == 23 + (endGame.transform.position.y))
        {
            lastIntPos = intPos;
        }

        if (!bombDroped && intPos.Y == (lastIntPos.Y - 1))
        {
            for (int i = 0; i < spawnPoints.Length; i++)
            {
                DropBomb(spawnPoints [i]);
            }

            lastIntPos = intPos;
            bombDroped = true;
        }

        if (transform.position.y <= -3)
        {
            laneControl.SomthingInLane = false;
            DestroyImmediate(this.gameObject);
        }
    }
Esempio n. 6
0
 void Start()
 {
     GM           = GameObject.Find("GameMaster").GetComponent <GameMaster> ();
     intPos       = IntPosition2D.Vector2ToIntPos2D(transform.position);
     catapultAnim = GetComponent <Animator> ();
 }