Example #1
0
    void Move()
    {
        if (Direction != null)
        {
            if (player.currentPos == (Vector2)transform.position && !hitOccured)
            {
                hitOccured = true;
                MM.die();
                // do something
            }
            transform.position += new Vector3(Direction.x, Direction.y);

            if (MM.map[(int)transform.position.x, (int)transform.position.y].TType == TileType.Wall)
            {
                //Player.PlayerTurnEnd -= Move;
                Destroy(gameObject);
            }

            if (player.currentPos == (Vector2)transform.position && !hitOccured)
            {
                hitOccured = true;
                MM.die();
                // do something
            }
        }
    }