상속: UnityEngine.StateMachineBehaviour
예제 #1
0
    void getCurrentTarget()
    {
        if (nowTarget != GameManager.NowTarget.Core)
        {
            switch (firstPriority)
            {
            case GameManager.NowTarget.Player:
                myTmpTarget = SceneManager.CalculationDis_Soldier(this, true);
                break;

            case GameManager.NowTarget.Soldier:
                myTmpTarget = SceneManager.CalculationDis_Soldier(this, false);
                break;

            case GameManager.NowTarget.Tower:
                myTmpTarget = SceneManager.CalculationDis_Tower(this);
                break;

            default:
                break;
            }

            if (myTmpTarget.myTarget != null)
            {
                _attributes = myTmpTarget.myTarget.GetComponent <isDead>();
                if (!_attributes.checkDead)
                {
                    nowTarget = _attributes.myAttributes;
                    goAtkPos(myTmpTarget.nowPointScript, myTmpTarget.goPos, _attributes);
                }
            }
        }
    }
예제 #2
0
    void FirstFormatData()
    {
        firstGetData = false;
        //
        map = GameObject.Find("smallMapContainer").GetComponent <RectTransform>();
        //
        skillManager       = GetComponent <SkillBase>();
        clickPointPos      = GameObject.Find("clickPointPos");
        nav                = GetComponent <NavMeshAgent>();
        deadManager        = GetComponent <isDead>();
        nav.updateRotation = false;
        MyCreatPoints      = GetComponent <CreatPoints>();
        myAudio            = GetComponent <AudioSource>();
        ani                = GetComponent <Animator>();
        AniControll        = GetComponent <PlayerAni>();

        if (photonView.isMine)
        {
            if (leftTopPowerBar == null)
            {
                leftTopPowerBar = GameObject.Find("mpBar_0020").GetComponent <Image>();
            }

            myMainCamera = Camera.main;
        }
        originalData = PlayerData.instance.getPlayerData(meIs);
    }
예제 #3
0
    public void goAtkPos(CreatPoints _tmpPoint, Transform firstPos, isDead _isdaed)
    {
        if (deadManager.checkDead)
        {
            return;
        }

        if (points != null)
        {
            points.RemoveThisPoint(correctPos);
        }

        points           = _tmpPoint;
        targetDeadScript = _isdaed;
        currentTarget    = _isdaed.gameObject;

        //前往找到的點
        points.AddWillGo_P(firstPos, correctPos);
        correctPos = firstPos;
        lastTmpPos = correctPos.position;
        resetChaseTime();

        //在距離內可直接攻擊
        if (IFRightNowAtk())
        {
            return;
        }

        nowState = states.AtkMove;
        getTatgetPoint(correctPos.position);
    }
예제 #4
0
        protected void FirstformatData()
        {
            firstGetData      = false;
            Net               = GetComponent <PhotonView>();
            myCachedTransform = this.transform;
            MyCreatPoints     = GetComponent <CreatPoints>();

            if (deadManager == null)
            {
                deadManager = GetComponent <isDead>();
            }

            if (photonView.isMine)
            {
                MyCreatPoints.enabled = false;
                originalTurretData    = TurretData.instance.getTowerData(DataName);
                checkCurrentPlay();
            }
            else
            {
                MyCreatPoints.ProdecePoints(myCachedTransform);
                originalTurretData = TurretData.instance.getEnemyTowerData(DataName);
                this.enabled       = false;
            }
        }
예제 #5
0
    void FirstformatData()
    {
        firstGetData = false;

        if (deadManager == null)
        {
            deadManager = GetComponent <isDead>();
        }

        Net           = GetComponent <PhotonView>();
        ani           = GetComponent <Animator>();
        myCollider    = GetComponent <CapsuleCollider>();
        nav           = GetComponent <NavMeshAgent>();
        myCreatPoints = GetComponent <CreatPoints>();
        if (photonView.isMine)
        {
            // nav.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance;
            originalData          = MyEnemyData.instance.getMySoldierData(DataName);
            myCreatPoints.enabled = false;
            checkCurrentPlay();
            nav.updateRotation = false;
        }
        else
        {
            originalData = MyEnemyData.instance.getEnemySoldierData(DataName);
            myCreatPoints.ProdecePoints();
            nav.enabled  = false;
            this.enabled = false;
        }
    }
예제 #6
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (isDeadScript == null)
        {
            isDeadScript = animator.GetComponent <isDead>();
        }

        animator.GetComponent <isDead>().notFeedBack = true;
    }
예제 #7
0
        public void FindEnemy()
        {
            tmpTarget = SceneManager.CalculationDis(myCachedTransform, turretData.Atk_Range, turretData.Atk_MinRange);

            if (tmpTarget != null)
            {
                target           = tmpTarget.transform;
                targetDeadScript = target.GetComponent <isDead>();
            }
        }
예제 #8
0
    public virtual void TP_Data(int _id)
    {
        targetNet            = PhotonView.Find(_id);
        targetDead           = targetNet.GetComponent <isDead>();
        enemyCachedTransform = targetDead.transform;

        /*targetPos = enemyCachedTransform.position;
         * targetPos.y += targetOffsetY;
         * dir = targetPos - myCachedTransform.position;*/
    }
예제 #9
0
    public void takeDamage(int _id, float _damage)
    {
        if (deadManager.checkDead)
        {
            return;
        }

        #region 反擊判斷
        if (photonView.isMine && _id != 0)
        {
            if (!firstAtk && !ifFirstAtkTarget())
            {
                isDead _isdead = PhotonView.Find(_id).GetComponent <isDead>();

                if (_isdead.myAttributes != GameManager.NowTarget.Tower)
                {
                    if (points != null && correctPos != null)
                    {
                        points.RemoveThisPoint(correctPos);
                    }

                    firstAtk = true;
                    resetChaseTime();
                    if (!NowCC)
                    {
                        nowState = states.BeAtk;
                        nav.ResetPath();
                        if (!ani.GetBool(aniHashValue[1]))
                        {
                            Net.RPC("TP_stopAni", PhotonTargets.All, true);
                        }

                        currentTarget    = _isdead.gameObject;
                        points           = _isdead.gameObject.GetComponent <CreatPoints>();
                        targetDeadScript = _isdead;

                        beAttackStop();
                    }
                    else
                    {
                        currentTarget    = _isdead.gameObject;
                        points           = _isdead.gameObject.GetComponent <CreatPoints>();
                        targetDeadScript = _isdead;
                    }
                }
            }
        }
        #endregion
        MyHelath(CalculatorDamage(_damage));
    }
예제 #10
0
    public void cancelSelectTarget(bool _now)
    {
        OtherSoldierNeedCancel();
        if (correctPos != null)
        {
            points.RemoveThisPoint(correctPos);
        }
        correctPos       = null;
        points           = null;
        targetDeadScript = null;
        currentTarget    = null;

        chaseTime = 0;
        nowTarget = GameManager.NowTarget.Null;
        firstAtk  = false;
        if (!_now)
        {
            chaseTime  = 1.5f;
            nowState   = states.Wait_TargetDie;
            stopDetect = false;
        }
    }
예제 #11
0
파일: OreObject.cs 프로젝트: Hengle/KaTaGy
 private void Start()
 {
     deadManager  = GetComponent <isDead>();
     oreBornPoint = this.transform;
     health       = maxHealth;
 }