예제 #1
0
    void Start()
    {
        #region Loading character prefab
        Gladiator           g = GameController.Instance.player.FightingGladiator;
        GladiatorController c = Instantiate(GameController.Instance.GetPrefabForGladiator(g)).GetComponent <GladiatorController>();
        c.gameObject.transform.position = new Vector3(0, 40, 0);
        c.Id = g._Id;
        if (g._Id == GameController.Instance.player.Opponent._Id)
        {
            c.gameObject.transform.localScale = new Vector3(-1, 1, 1);
        }
        c.transform.SetParent(LooserContainer.transform, false);
        c.SwitchState(GladiatorController.AnimationState.Kneeling);
        #endregion

        Stats.text = "";

        TinyMessengerHub.Instance.Publish <Msg.HideArrowKeys>(new Msg.HideArrowKeys(true));
        StartCoroutine(FateKill());
    }
예제 #2
0
 void Start()
 {
     _animMngr = transform.GetComponent<AnimationStateManager>();
     _animationPhaseTime = new float[4];
     _animationPhaseTime[0] = 0.37f;
     _animationPhaseTime[1] = 0.44f;
     _animationPhaseTime[2] = 0.505f;
     _animationPhaseTime[3] = 0.833f;
     _layerGladiator = 1 << 9;
     _gldCtrl = transform.GetComponent<GladiatorController>();
     switch (GladiatorNetwork._myGladiator.Class)
     {
     case SelectClass.eClass.LIGHT:
         _damage = 8;
         _rcDistance = 1.3f; break;
     default:
         _damage = 10;
         _rcDistance = 0.9f; break;
     }
 }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        TinyTokenManager.Instance.Register <Msg.UpgradeFinished>("LEVEL_UP" + GetInstanceID() + "FIN", (m) => {
            TinyTokenManager.Instance.Unregister <Msg.UpgradeFinished>("LEVEL_UP" + GetInstanceID() + "FIN");

            Destroy(oldGC.gameObject);

            if (levelProgress)
            {
                GameController.Instance.player.FightingGladiator.Level++;

                Gladiator g2          = GameController.Instance.player.FightingGladiator;
                GladiatorController c = Instantiate(GameController.Instance.GetPrefabForGladiator(g2)).GetComponent <GladiatorController>();
                c.Id = g2._Id;
                c.gameObject.transform.position = new Vector3(0, 110, 0);

                c.transform.SetParent(CharacterHolder.transform, false);
                c.SwitchState(GladiatorController.AnimationState.Idle);
            }

            TinyMessengerHub.Instance.Publish <Msg.HideArrowKeys>(new Msg.HideArrowKeys(false));
            TinyTokenManager.Instance.Register <Msg.SelectPerformed>("LEVEL_UP" + GetInstanceID() + "SELECT", (msg) => {
                Unregister();
                StartCoroutine(Finish());
            });
        });

        if (GameController.Instance.player.FightingGladiator.LastLevelUpedAbility.Level > GameController.Instance.player.FightingGladiator.Level)
        {
            levelProgress = true;
        }

        #region Creating Gladiator
        Gladiator g = GameController.Instance.player.FightingGladiator;
        oldGC = Instantiate(GameController.Instance.GetPrefabForGladiator(g)).GetComponent <GladiatorController>();
        oldGC.gameObject.transform.position = new Vector3(0, 110, 0);
        oldGC.Id = g._Id;

        oldGC.transform.SetParent(CharacterHolder.transform, false);
        if (levelProgress)
        {
            oldGC.SwitchState(GladiatorController.AnimationState.Upgrade);
        }
        else
        {
            oldGC.SwitchState(GladiatorController.AnimationState.Idle);
        }
        #endregion

        ActionDetails ab = (ActionDetails)Instantiate(_AbilityHolder);
        ab.transform.SetParent(NewSKill.transform, false);
        ab.SetAbility(GameController.Instance.player.FightingGladiator.LastLevelUpedAbility);

        foreach (ActiveAbility a in GameController.Instance.player.FightingGladiator.EvolvedAbilities)
        {
            ActionDetails abb = (ActionDetails)Instantiate(_AbilityHolder);
            abb.transform.SetParent(OldSkills.transform, false);
            abb.SetAbility(a);
        }

        GameController.Instance.player.FightingGladiator.LastLevelUpedAbility = null;

        TinyMessengerHub.Instance.Publish <Msg.HideArrowKeys>(new Msg.HideArrowKeys(true));

        if (!levelProgress)
        {
            TinyMessengerHub.Instance.Publish <Msg.UpgradeFinished>(new Msg.UpgradeFinished());
        }
    }
예제 #4
0
    void Start()
    {
        if (GameController.Instance.player == null)
        {
            return;
        }

        GameController.Instance.player.NumberOfVictories++;

        #region Creating Gladiator
        Gladiator           g = GameController.Instance.player.Opponent;
        GladiatorController c = Instantiate(GameController.Instance.GetPrefabForGladiator(g)).GetComponent <GladiatorController>();
        c.gameObject.transform.position = new Vector3(0, 40, 0);
        c.Id = g._Id;
        if (g._Id == GameController.Instance.player.Opponent._Id)
        {
            c.gameObject.transform.localScale = new Vector3(-1, 1, 1);
        }
        c.transform.SetParent(LooserContainer.transform, false);
        c.SwitchState(GladiatorController.AnimationState.Kneeling);
        #endregion

        FreeSlot.text = "";
        if (GameController.Instance.player.CanAddToParty())
        {
            FreeSlot.gameObject.SetActive(false);
        }
        else
        {
            FreeSlot.gameObject.SetActive(true);
            FreeSlot.text = "You don't have free slots in your party to fit new gladiator";
        }
        abilityLimitReached = false;
        if (GameController.Instance.player.FightingGladiator.PassiveAbilities.Count + GameController.Instance.player.FightingGladiator.ActiveAbilities.Count >=
            GameController.Instance.MaxAbilitiesPerGladiator)
        {
            FreeSlot.gameObject.SetActive(true);
            abilityLimitReached = true;
            FreeSlot.text      += "\nAbility limit reached: " + GameController.Instance.MaxAbilitiesPerGladiator;
        }

        _SelectedAbility = 0;

        #region Loading Opponent skill list
        _LooserList = new List <Ability>();
        foreach (PassiveAbility p in GameController.Instance.player.Opponent.PassiveAbilities)
        {
            _LooserList.Add(p);
        }
        foreach (ActiveAbility a in GameController.Instance.player.Opponent.ActiveAbilities)
        {
            _LooserList.Add(a);
        }
        //removing passive abilities that player already posses
        foreach (PassiveAbility p in GameController.Instance.player.FightingGladiator.PassiveAbilities)
        {
            if (_LooserList.Contains(p))
            {
                _LooserList.Remove(p);
            }
        }

        foreach (Ability p in _LooserList)
        {
            ActionDetails action = Instantiate(ActionDetailsPrefab);
            action.transform.SetParent(LooserSkillsList.transform, false);
            action.SetAbility(p);
        }
        #endregion

        TinyMessengerHub.Instance.Publish <Msg.HideArrowKeys>(new Msg.HideArrowKeys(true));
        StartCoroutine(DecideFait());
    }
예제 #5
0
 void Awake()
 {
     _cam = transform.GetComponent<GladiatorCamera>();
     _ctrler = transform.GetComponent<GladiatorController>();
     _attackEventManager = transform.GetComponent<AttackEventManager>();
     _charCtrl = transform.GetComponent<CharacterController>();
     _animationManager = transform.GetComponent<AnimationStateManager>();
     if (photonView.isMine)
         _myGladiator = this;
 }
예제 #6
0
    public void LoadGladiator(Gladiator g)
    {
        #region Loading Passive abilities list

        _GladiatorId = g._Id;
        GladiatorController c = Instantiate(GameController.Instance.GetPrefabForGladiator(g)).GetComponent <GladiatorController>();
        c.gameObject.transform.position = new Vector3(0, 40, 0);
        c.Id = g._Id;
        if (g._Id == GameController.Instance.player.Opponent._Id)
        {
            c.gameObject.transform.localScale = new Vector3(-1, 1, 1);
        }
        c.transform.SetParent(_LoadCharacterToThis.transform, false);

        #endregion

        TinyTokenManager.Instance.Register <Msg.GladiatorHealthChanged>("GLADIATOR_HOLDER_" + GetInstanceID() + "HEALTH_CHANGED",
                                                                        (m) => {
            if (m.GladiatorId == _GladiatorId)
            {
                Health.Value = m.NewValue;
            }
        });
        TinyTokenManager.Instance.Register <Msg.GladiatorAdrenalineChanged>("GLADIATOR_HOLDER_" + GetInstanceID() + "ADRENALINE_CHANGED",
                                                                            (m) => {
            if (m.GladiatorId == _GladiatorId)
            {
                Adrenaline.Value = m.NewValue;
            }
        });
        TinyTokenManager.Instance.Register <Msg.NotEnughAdrenaline>("GLADIATOR_HOLDER_" + GetInstanceID() + "NOT_ENOUGH_ADRENALINE",
                                                                    (m) => {
            if (m.GladiatorId == _GladiatorId)
            {
                _Adrenaline.gameObject.SetActive(true);
                Text t = _Adrenaline.GetComponent <Text>();
                t.text = "NOT ENOUGH ADRENALINE!";

                t.color = new Color(1.0f, 1.0f, 0.4f, 1.0f);
            }
        });
        TinyTokenManager.Instance.Register <Msg.DealDamage>("GLADIATOR_HOLDER_" + GetInstanceID() + "DAMAGE_RECEIVED",
                                                            (m) => {
            if (m.GladiatorID == _GladiatorId)
            {
                _Damage.gameObject.SetActive(true);
                Text t = _Damage.GetComponent <Text>();
                t.text = "-" + m.Damage;

                t.color = GameController.Instance.GetColorForAbilityColor(
                    _GladiatorId == GameController.Instance.player.FightingGladiator._Id ?
                    GameController.Instance.player.Opponent.LastActiveColor :
                    GameController.Instance.player.FightingGladiator.LastActiveColor
                    );
            }
        });
        TinyTokenManager.Instance.Register <Msg.AbilitySmirked>("GLADIATOR_HOLDER_" + GetInstanceID() + "SMIRKED",
                                                                (m) => {
            if (m.SmirkGladiatorTargetId == _GladiatorId)
            {
                _Smirk.gameObject.SetActive(true);
                Text t = _Smirk.GetComponent <Text>();

                t.color = GameController.Instance.GetColorForAbilityColor(
                    _GladiatorId == GameController.Instance.player.FightingGladiator._Id ?
                    GameController.Instance.player.FightingGladiator.LastActiveColor :
                    GameController.Instance.player.Opponent.LastActiveColor
                    );
            }
        });
        TinyTokenManager.Instance.Register <Msg.PrepareToPerformAttack>("GLADIATOR_HOLDER_" + GetInstanceID() + "PREPARE_TO_ATTACK",
                                                                        (m) => {
            _Smirk.gameObject.SetActive(false);
            _Damage.gameObject.SetActive(false);
            _Adrenaline.gameObject.SetActive(false);
        });
        TinyTokenManager.Instance.Register <Msg.StartFightRound>("GLADIATOR_HOLDER_" + GetInstanceID() + "START_FIGHT_ROUND",
                                                                 (m) => {
            _Smirk.gameObject.SetActive(false);
            _Damage.gameObject.SetActive(false);
            _Adrenaline.gameObject.SetActive(false);
        });
    }