/// <summary> /// 给予或动态添加PersonMove组件 /// </summary> /// <returns></returns> public PersonMove GetPersonMove() { PersonMove personMove = GetComponent <PersonMove>(); if (personMove == null) { personMove = gameObject.AddComponent <PersonMove>(); } return(personMove); }
public MoveCommand(string npcName, Vector2 targetPoint, bool needAC = false) {//谁移动到哪个位置 this.npcName = npcName; this.targetPoint = targetPoint; needAsync = needAC; //如果是Player if (npcName == "Player") { personMove = PlayerPropertyManager.PlayerGo.GetComponent <AIAttribute>().GetPersonMove(); } else {//不是玩家 //获取这个角色身上的PersonMove组件 personMove = ObjectManager.GetGameObject(npcName).GetComponent <AIAttribute>().GetPersonMove(); } }
protected override void Start() { try { Log.Info("LocationHistoryPathBase.Start Start");//2019_06_26_cww:昨天做代码重构,提取了PositionInfo PositionInfoList PositionInfoGroup,崩溃了,加打印语句,加着加着就不崩溃了。上次崩溃时是有运行到这里的。 personmove = gameObject.GetComponent <PersonMove>(); StartInit(); //将方向转换为四元数 targetQuaternion = Quaternion.LookRotation(Vector3.zero, Vector3.up); CreateHistoryPath(); isCreatePathComplete = true; //if (MultHistoryPlayUI.Instance.isNewWalkPath) //{ // //CreatePathSphere(); //} Log.Info("LocationHistoryPathBase.Start End"); } catch (Exception ex) { Log.Error("LocationHistoryPathBase.Start", ex.ToString()); } }
void Start() { move = GetComponent <PersonMove>(); FirstObjc = GameObject.FindGameObjectWithTag("FirstPosToHouse"); SecondObjc = GameObject.FindGameObjectWithTag("SecondPosToHouse"); }