public Actor AddActor(int id, EActorType type, EBattleCamp camp, XTransform param, bool isMainPlayer = false) { Actor pActor = null; if (isMainPlayer) { pActor = new ActorMainPlayer(id, 100, EActorType.PLAYER, camp); pActor.Load(param); object[] args = new object[] { pActor.CacheTransform.transform }; CameraEffectBase effect = MainCamera.GetComponent <CameraFollow>(); effect.Init(0, MainCamera, null, args); } else { pActor = new ActorPlayer(id, 100, type, camp); pActor.Load(param); } if (pActor.CacheTransform != null) { Debug.LogError("添加人物" + pActor.ActorType); //pActor.CacheTransform.parent = GetHolder(EMapHolder.Role).transform; AllActors.Add(pActor); //LevelData.CampActors[camp].Add(pActor); } return(pActor); }
public static void Cache(EActorType type, int nResId, int nCount) { for (int i = 0; i < nCount; ++i) { Cache(type, nResId); } }
public Actor(int id, int guid, EActorType type, EBattleCamp camp, List <Vector3> PatrolGroups) : base(id, guid) { this.ActorType = type; this.Camp = camp; this.PatrolGroups = PatrolGroups; this.MonsterType = GameDataManage.Instance.GetDBEntiny(Id).MonsterType; }
// ======================================================== // // Overriding actor functions // // ======================================================== public override void InitializeActor(EActorType _ActorType, string _ActorName) { base.InitializeActor(_ActorType, _ActorName); if (ActorStats == null) { Debug.LogError($"{this.name} doesn't have Actor Stats assigned!"); } }
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 override void Read(XmlElement element) { this.Id = element.GetInt32("Id"); this.Level = element.GetInt32("Level"); this.Title = element.GetInt32("Title"); this.Name = element.GetString("Name"); this.Desc = element.GetString("Desc"); this.Icon = element.GetString("Icon"); this.Race = (EActorRace)element.GetInt32("Race"); this.Type = (EActorType)element.GetInt32("Type"); this.Sex = (EActorSex)element.GetInt32("Sex"); this.Sort = (EActorSort)element.GetInt32("Sort"); this.Unit = (EActorUnit)element.GetInt32("Unit"); this.Carrer = (ECarrer)element.GetInt32("Carrer"); this.Group = element.GetInt32("Group"); this.Quality = element.GetInt32("Quality"); this.RSpeed = element.GetFloat("RSpeed"); this.WSpeed = element.GetFloat("WSpeed"); this.BornEffectID = element.GetInt32("BornEffectID"); this.DeadEffectID = element.GetInt32("DeadEffectID"); this.StagePos = element.GetString("StagePos").ToVector3(true); this.StageScale = element.GetFloat("StageScale"); this.Skill = element.GetString("Skill"); this.Model = element.GetInt32("Model"); this.Exp = element.GetInt32("Exp"); this.Gold = element.GetInt32("Gold"); for (int i = 1; i <= 16; i++) { int v = element.GetInt32("P" + i.ToString()); this.Propertys.Add((EAttr)i, v); } this.Natures[EActorNature.CAN_MOVE] = element.GetInt32("CanMove") == 1; this.Natures[EActorNature.CAN_KILL] = element.GetInt32("CanKill") == 1; this.Natures[EActorNature.CAN_MANUALATTACK] = element.GetInt32("CanManualAttack") == 1; this.Natures[EActorNature.CAN_TURN] = element.GetInt32("CanTurn") == 1; this.Natures[EActorNature.CAN_STUN] = element.GetInt32("CanStun") == 1; this.Natures[EActorNature.CAN_BEATBACK] = element.GetInt32("CanBeatBack") == 1; this.Natures[EActorNature.CAN_BEATFLY] = element.GetInt32("CanBeatFly") == 1; this.Natures[EActorNature.CAN_BEATDOWN] = element.GetInt32("CanBeatDown") == 1; this.Natures[EActorNature.CAN_WOUND] = element.GetInt32("CanWound") == 1; this.Natures[EActorNature.CAN_REDUCESPEED] = element.GetInt32("CanReduceSpeed") == 1; this.Natures[EActorNature.CAN_FIXBODY] = element.GetInt32("CanFixBody") == 1; this.Natures[EActorNature.CAN_SLEEP] = element.GetInt32("CanSleep") == 1; this.Natures[EActorNature.CAN_VARISTION] = element.GetInt32("CanVaristion") == 1; this.Natures[EActorNature.CAN_PARALY] = element.GetInt32("CanParaly") == 1; this.Natures[EActorNature.CAN_FEAR] = element.GetInt32("CanFear") == 1; }
public static List <Actor> GetActorsByActorType(EActorType pType) { List <Actor> pList = new List <Actor>(); for (int i = 0; i < AllActors.Count; i++) { if (AllActors[i].ActorType == pType) { pList.Add(AllActors[i]); } } return(pList); }
public static void Cache(EActorType type, int nResId) { string strRolePrefab = null; switch (type) { case EActorType.Hero: ResActor resHero = DataReader <ResActor> .Get(nResId); if (null == resHero) { Debug.LogError("Error Hero ID = " + nResId); return; } strRolePrefab = resHero.prefab; break; case EActorType.Monster: ResActor resMonster = DataReader <ResActor> .Get(nResId); if (null == resMonster) { Debug.LogError("Error Hero ID = " + nResId); return; } strRolePrefab = resMonster.prefab; break; } Object cPrefab = CResourceSys.Instance.LoadRole(strRolePrefab); if (null == cPrefab) { Debug.LogError("can't load prefabs id:" + nResId); return; } GameObject objRole = ObjectPoolSys.Instance.Cache(cPrefab); objRole.transform.parent = HeroRoot; objRole.transform.localScale = Vector3.one; objRole.transform.localPosition = Vector3.zero; objRole.transform.localEulerAngles = Vector3.zero; }
/// <summary> /// Can the variables in this VarLink not be swapped with another? /// </summary> /// <param name="info"></param> /// <returns></returns> private static bool CanLinkBeRandomized(SeqTools.VarLinkInfo info, out EActorType actorType) { actorType = EActorType.Invalid; if (info.LinkedNodes.Count != 1) { return(false); } if (info.LinkDesc.Contains("Owner", StringComparison.InvariantCultureIgnoreCase) || info.LinkDesc.Contains("Puppet", StringComparison.InvariantCultureIgnoreCase)) { actorType = EActorType.Actor; return(true); } else if (info.LinkDesc.Contains("Node", StringComparison.InvariantCultureIgnoreCase)) { actorType = EActorType.NodePosition; return(true); // Node is position data. We need to apply special logic to ensure this is properly changed } 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); }
public ActorMainPlayer(int id, int guid, EActorType type, EBattleCamp camp) : base(id, guid, type, camp) { }
public ActorMainPlayer(int id, int guid, EActorType type, EBattleCamp camp, List <Vector3> PatrolGroups) : base(id, guid, type, camp, PatrolGroups) { }
public Actor AddActor(int id, EActorType type, EBattleCamp camp, Vector3 pos, Vector3 angle, Vector3 scale, List <Vector3> PatrolGroups) { return(AddActor(id, type, camp, XTransform.Create(pos, angle, scale), PatrolGroups)); }
static public float ActorDepth(EActorType eActorType) { return((int)(eActorType + 1) * SINGLE_ACTOR_DEPTH); }
static public float WorldActorDepth(float y, EActorType eActorType) { return(WorldDepth(y) + ActorDepth(eActorType)); }
public Actor(int id, int guid, EActorType type, EBattleCamp camp) : base(id, guid) { this.ActorType = type; this.Camp = camp; //this.MonsterType = ZTConfig.Instance.GetDBEntiny(Id).MonsterType; }
public Character AddActorNoneSync(int id, EBattleCamp camp, EActorType type, KTransform bornData) { return(AddActor(id, camp, type, bornData, null, false)); }
public virtual void InitializeActor(EActorType _ActorType, string ActorName) { m_CurrentPosition = new Vector2(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.y)); m_ActorType = _ActorType; m_ActorName = ActorName; }