예제 #1
0
    public virtual IEnumerator GoOnCooldown(SkillExecute sk)
    {
        sk.onCooldown = true;
        yield return(new WaitForSeconds(sk.skillCooldown));

        sk.onCooldown = false;
    }
예제 #2
0
    void Awake()
    {
        // playersTeam = new ICharObject[4];

        //  enemyTeam = new ICharObject[4];

        SceneManager.sceneLoaded += TownManagerInitialize;



        battleManager = GetComponent <BattleManager>();
        skillManager  = GetComponent <SkillExecute>();
        playersTeam   = GetComponent <PlayersTeam>();
        enemyTeam     = GetComponent <EnemyTeam>();
        ui            = GetComponent <UIManager>();
        inventory     = GetComponent <InventoryManager>();
        // teamBuilder = ScriptableObject.CreateInstance(typeof(TeamBuilder)) as TeamBuilder;
        managers = new List <IManager>();

        // managers.Add(battleManager);
        managers.Add(skillManager);
        // managers.Add(ui);
        managers.Add(playersTeam);
        managers.Add(enemyTeam);
        managers.Add(inventory);
        // managers.Add(teamBuilder);
        Initialize();

        DontDestroyOnLoad(this);
    }
예제 #3
0
 void SkillUpdate(SkillExecute sk, int index)
 {
     if (sk != null)
     {
         if (sk.onCooldown)
         {
             try
             {
                 skillImages[index].fillAmount -= 1 / sk.skillCooldown * Time.deltaTime;
                 if (skillImages[index].fillAmount <= 0)
                 {
                     skillImages[index].fillAmount = 0;
                 }
             }
             catch { Debug.Log("No UI element assigned!"); }
         }
     }
 }
예제 #4
0
 public void PlayAnimation(SkillExecute sk)
 {
     entityAnimator.Play(sk.skillname);
 }
예제 #5
0
    public virtual IEnumerator UsePersistentEffect(SkillExecute sk)
    {
        yield return(new WaitForSeconds(sk.duration));

        sk.DeActivateSkillActive();
    }
예제 #6
0
    public virtual void ActivateSkill(SkillExecute sk, int index)
    {
        if (entityAnimator.GetFloat("attackCancelFloat") < 1f)
        {
            if (!sk.onCooldown)
            {
                if (!usingSkill)
                {
                    //PlayerManager.Instance.ZoomCameraInAndOut();
                    //SHOULD ONLY BE CALLED AFTER SKILL GOES ON COOLDOWN, EG. Stance change only goes on cooldown after the duration is over

                    try
                    {
                        skillUI.OnSkillUse(index);
                    }
                    catch
                    {
                        Debug.Log("skill UI not updating correctly");
                    }

                    try
                    {
                        _playerManager.StopAttacking();
                    }
                    catch
                    {
                        Debug.Log("Playermanager.StopAttacking");
                    }
                    //SKILL SHOULD DETERMINE WHICH ANIMATION TO USE
                    //Currently uses animation length to determine skill duration, probably should work other way around?

                    try
                    {
                        sk.Execute(sk.animationClip.length);
                    }
                    catch
                    {
                        try { sk.Execute(); }
                        catch { Debug.Log("Skill Execute"); }
                        Debug.Log("No skill animation!");
                    }

                    try
                    {
                        var ps = Instantiate(defaultParticles, VFXPoint.position, Quaternion.identity);
                        Destroy(ps, 0.5f);
                    }
                    catch { Debug.Log("Particles"); }
                    try
                    {
                        AddInvulnerability(sk.iFrameDuration);
                    }
                    catch
                    {
                        Debug.Log("Iframe");
                    }
                    try
                    {
                        StartCoroutine(GoOnCooldown(sk));
                    }
                    catch
                    {
                        Debug.Log("Cooldown");
                    }
                }
                else
                {
                    Debug.Log("Using a skill!");
                }
            }
            else
            {
                Debug.Log("Skill on Cooldown!");
            }
        }
        else
        {
            Debug.Log("Animation in progress!");
        }
    }