public Character AddActor(int id, EBattleCamp camp, EActorType type, GTTransform bornData, XCharacter data, bool isMain = false) { Character cc = new Character(id, data == null ? GTGUID.NewGUID() : data.GUID, type, camp, isMain); bornData.Pos = GTTools.NavSamplePosition(bornData.Pos); cc.Load(bornData); cc.SyncData(data, ESyncDataType.TYPE_ALL); SetCharacterParent(cc); Characters.Add(cc); return(cc); }
public bool CanReachPosition(Vector3 dest) { Vector3 position = GTTools.NavSamplePosition(dest); mNavMeshAgent.enabled = true; mNavMeshAgent.CalculatePath(position, mNavMeshPath); if (mNavMeshPath.status != NavMeshPathStatus.PathPartial) { return(true); } return(false); }
public Actor AddActor(int id, EActorType type, EBattleCamp camp, XTransform param, List <Vector3> PatrolGroups, bool isMainPlayer = false) { int guid = GetGUID(); Actor pActor = null; switch (type) { case EActorType.PLAYER: { if (isMainPlayer) { pActor = new ActorMainPlayer(id, guid, EActorType.PLAYER, camp, null); } else { pActor = new ActorPlayer(id, guid, EActorType.PLAYER, camp, null); } } break; case EActorType.MONSTER: pActor = new Actor(id, guid, type, camp, PatrolGroups); break; } if (pActor != null) { param.Position = GTTools.NavSamplePosition(param.Position); pActor.Load(param); if (pActor.CacheTransform != null) { pActor.CacheTransform.parent = GetHolder(EMapHolder.Role).transform; LevelData.AllActors.Add(pActor); LevelData.CampActors[camp].Add(pActor); } } return(pActor); }