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); } } } }
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); }
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); }
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; } }
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; } }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (isDeadScript == null) { isDeadScript = animator.GetComponent <isDead>(); } animator.GetComponent <isDead>().notFeedBack = true; }
public void FindEnemy() { tmpTarget = SceneManager.CalculationDis(myCachedTransform, turretData.Atk_Range, turretData.Atk_MinRange); if (tmpTarget != null) { target = tmpTarget.transform; targetDeadScript = target.GetComponent <isDead>(); } }
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;*/ }
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)); }
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; } }
private void Start() { deadManager = GetComponent <isDead>(); oreBornPoint = this.transform; health = maxHealth; }