Пример #1
0
    public override bool CanBeActivated()
    {
        Base building   = _mapEntetiesManager.GetEntitieOfType <Base>(Unit.Position) as Base;
        bool capturable = building != null && building.Team != Unit.Team;

        return(capturable);
    }
Пример #2
0
    public void Confirm()
    {
        TileEntity t = _entetieManager.GetEntitieOfType <BaseUnit>(Position);

        if (t != null && t is BaseUnit && t.Player == _gameState.CurrentPlayerTurn)
        {
            _currentSelection = t as BaseUnit;
            _currentSelection.Select();
            _currentlyAlloweMoveTiles = _currentMap.GetAvailableTilesForUnit(_currentSelection).ToList();
        }
    }
Пример #3
0
    void RpcMoveFromServer(int x1, int y1, int x2, int y2)
    {
        //u.transform.position = new Vector3(move, 0, 0);
        //u.Pos = move;
        Debug.Log("is local player? " + isLocalPlayer);
        TileEntity t = _mapEntetiesManager.GetEntitieOfType <TileEntity>(new Vector2Int(x1, y1));

        if (t)
        {
            t.RpcMove(x2, y2, false);
        }
    }
    private void UpdateUnitsInfo()
    {
        BaseUnit unit = _mapEntetieManager.GetEntitieOfType <BaseUnit>(_selection.Position) as BaseUnit;

        if (unit)
        {
            if (_infoGroupsForEnteties.Count < 2)
            {
                _infoGroupsForEnteties.Add(_tileInfoGroupFactory.Create());
                _infoGroupsForEnteties[1].transform.SetAsFirstSibling();
            }
            _infoGroupsForEnteties[1].gameObject.SetActive(true);
            _infoGroupsForEnteties[1].UpdateInfo(unit.GetComponent <SpriteRenderer>().sprite, unit.name);
            AddUnitFields(_infoGroupsForEnteties[1], unit);
        }
        else
        {
            if (_infoGroupsForEnteties.Count > 1)
            {
                _infoGroupsForEnteties[1].gameObject.SetActive(false);
            }
        }
    }