Exemple #1
0
 public void Attack(CharacterIF target, int row, Vector2 _attackPos)
 {
     attackPos     = _attackPos;
     state         = CharState.moving;
     timeSinceMove = 0;
     startPos      = transform.position;
     returnAttack  = false;
 }
Exemple #2
0
    bool MoveCharacterInGrid(CharacterIF c, int x, int y)
    {
        var pos = FindCharacterInGrid(c);

        if (pos.Item1 != -1)
        {
            if (x + c.GetLength() < gridLength && y + c.GetWidth() < gridWidth)
            {
                for (int i = 0; i < c.GetWidth(); i++)
                {
                    for (int j = 0; j < c.GetLength(); j++)
                    {
                        if (grid[x + i, y + j] != null)
                        {
                            //reserves.send(character);
                        }
                        grid[pos.Item1 + i, pos.Item2 + j] = null;
                    }
                }
            }
        }
        return(false);
    }
Exemple #3
0
    bool AddCharacterToGrid(CharacterIF c, int x, int y)
    {
        for (int i = 0; i < c.GetWidth(); i++)
        {
            for (int j = 0; j < c.GetLength(); j++)
            {
                if (grid[x + i, y + j] != null)
                {
                    return(false);
                }
            }
        }

        for (int i = 0; i < c.GetWidth(); i++)
        {
            for (int j = 0; j < c.GetLength(); j++)
            {
                grid[x + i, y + j] = c;
            }
        }

        return(true);
    }