Пример #1
0
 public void Release(ListUpgrade type, VFXArcher obj)
 {
     if (pooling.ContainsKey(type))
     {
         pooling[type].Release(obj);
     }
 }
Пример #2
0
    private VFXArcher Create(int insId, VFXArcher prefab)
    {
        VFXArcher obj = Instantiate(prefab);

        obj.FirstSetup(insId);

        return(obj);
    }
Пример #3
0
        public void StopAttackEffect()
        {
            if (effect != null)
            {
                VfxPooling.Release(Type, effect);

                targetAgent = null;
                effect      = null;
            }
        }
Пример #4
0
        private void CheckAttack()
        {
            if (!string.IsNullOrEmpty(UnitInfo.Attack_Unit_ID) &&
                UnitInfo.Attack_Unit_ID.ToLower() != "null")
            {
                string[] strs    = UnitInfo.Attack_Unit_ID.Split('_');
                int      otherID = int.Parse(strs[3]);

                AgentRemote other = AgentRemoteManager.GetAgentRemote(otherID);
                targetAgent = other;

                if (other != null && !IsMoving())
                {
                    transform.forward = (other.transform.position - transform.position).normalized;
                    Animator.Play(AnimState.Attack1);

                    AttackTarget = other.transform;
                    if (effect == null)
                    {
                        Debugger.Log("call attack effect");
                        effect = VfxPooling.GetItem(Type);
                        effect.transform.position = transform.position;

                        effect?.Attack(AttackTarget);
                    }
                    else
                    {
                        effect.Attack(AttackTarget);
                    }
                }
            }
            else
            {
                AnimatorController.StateInfo attackState = Animator.GetStateInfo(AnimState.Attack1);
                if (attackState != null && attackState.IsPlaying)
                {
                    attackState.Stop();
                    StopAttackEffect();
                }
            }
        }