Пример #1
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();
                }
            }
        }
Пример #2
0
    protected override void Start()
    {
        base.Start();
        events.AddEmiter("S_DEPLOY", S_DEPLOY);
        //events.On("R_DEPLOY", R_DEPLOY);
        events.On("R_DEPLOY",
                  delegate(SocketIOEvent obj)
        {
            R_DEPLOY(obj);
            forTest.R_DEPLOY(obj);
        });

        DeployButton.OnClickEvents += OnDeployButton;


        dbRef             = Singleton.Instance <DBReference>();
        unitDataReference = Singleton.Instance <AgentRemoteManager>();

        wayPointFactory      = Singleton.Instance <NodeManagerFactory>();
        agentWayPointManager = (SingleWayPointManager)wayPointFactory.GetManager <AgentWayPoint>(NodeManagerFactory.NodeType.Single);
    }