Ejemplo n.º 1
0
        public void Activate()
        {
            // TODO :: 카드 사용하는 애니메이션
            if (_isActivated)
            {
                return;
            }

            if (_gm.currentTurn == _gm.Player)
            {
                _owner = _gm.Player;
            }
            else
            {
                _owner = _gm.Opponent;
            }

            Debug.Log("************Activate : " + _owner);

            var isUseable = _owner.population.UsePopulation(_super.cardNeededPeople);

            if (!isUseable)
            {
                return;// TODO :: 안된다는 소리
            }
            _isActivated = true;

            if (_gm.currentTurn == _gm.Player)
            {
                _am.PlayCardGotoCemetery(transform, FindManager.PlayerCemetery.transform);
                FindManager.LogManager.GetComponent <LogManager>().PresentLog(_super.logPrefab);
                OnActivate();
            }
            else
            {
                Debug.Log("Opponent Turn Card Use Animation");
                _am.PlayOpponentCard(GetComponent <RectTransform>(), FindManager.OpponentCardViewPosition.transform.position, () =>
                {
                    Debug.Log("Opponent PlayCardGotoCemetery");
                    _am.PlayCardGotoCemetery(transform, FindManager.OpponentCemetery.transform, () =>
                    {
                        // TODO :: UIManager로 돌리자
                        FindManager.LogManager.GetComponent <LogManager>().PresentLog(_super.logPrefab);
                        OnActivate();
                        StartCoroutine(WaitForDeActivate(() => _gm.Opponent.UseCard()));
                    });
                });
            }
        }
Ejemplo n.º 2
0
        private void Awake()
        {
            _gm          = GameManager.Instance;
            _rotateAngle = CalculateAngle(GameManager.slotSize);

            _slots = new Slot[GameManager.slotSize];

            _rotationPolicy = new Policy.RotationPolicy
            {
                SpeedPerTurn = 1
            };
            //_stat = GetComponent<Stat>();
            _activePoint = 0; //NOTE :: 처음 시작할 때 가장 맨 머리위에있는 자식의 번호

            _owner        = GetComponent <Players.Playable>();
            _health       = GetComponent <Health>();
            _health.OnDie = () =>
            {
                _gm.EndGame(_owner);
            };

            if (GetComponent <Players.Player>() != null)
            {
                _hpObject         = FindManager.PlayerPlanetStatic.transform.GetChild(0).gameObject;
                _populationObject = FindManager.PlayerPlanetStatic.transform.GetChild(1).gameObject;
                _shield           = FindManager.PlayerPlanetStatic.transform.GetChild(2).gameObject;
            }
            else
            {
                _hpObject         = FindManager.OpponentPlanetStatic.transform.GetChild(0).gameObject;
                _populationObject = FindManager.OpponentPlanetStatic.transform.GetChild(1).gameObject;
                _shield           = FindManager.OpponentPlanetStatic.transform.GetChild(2).gameObject;
            }

            //MakeSlot(GameManager.slotSize);
        }