public static ActorGroupModel GetGroupModel(ActorGroup model) { return(model != null ? new ActorGroupModel { Id = model.Id, Name = model.Name } : null); }
public override void FireFrom(Ship ship, ActorGroup group) { base.FireFrom(ship, group); this.Momentum /= 2.0f; this.TimeDeath = World.Time + (long)(World.Hook.BulletLife * World.Hook.SeekerLifeMultiplier); this.Sprite = API.Common.Sprites.seeker; this.Size = 100; }
public ActorGroup GetActorGroup(byte groupId) { ActorGroup group; if (!this.actorGroups.TryGetValue(groupId, out group)) { group = new ActorGroup(groupId); this.actorGroups.Add(groupId, group); } return group; }
public ActorGroup GetActorGroup(byte groupId) { ActorGroup group; if (!this.actorGroups.TryGetValue(groupId, out group)) { group = new ActorGroup(groupId); this.actorGroups.Add(groupId, group); } return(group); }
public Flag(World world, Sprites flagSprite, Team team, Base b) : base(world) { Size = 300; Team = team; Base = b; Sprite = flagSprite; FlagGroup = new ActorGroup(world); FlagGroup.ZIndex = 200; this.Group = FlagGroup; Position = world.RandomPosition(); }
void Init(GameObject model, ActorType eType, ActorGroup actorGroup, uint actorID) { UID = m_NextValidGameObjectID; m_NextValidGameObjectID++; MyModel = model; ActorID = actorID; MyActorBaseAttribBehaviour.Init(eType, actorGroup, actorID); MyActorMove.Init(this); MyActorSkill.Init(actorID); MyActorMove.MoveTo(new Vector3(50, 50, 0)); }
public Token(World world) : base(world) { Size = 200; Sprite = Sprites.haste_powerup; Mode = 0; TokenGroup = new ActorGroup(world); TokenGroup.ZIndex = 150; TokenGroup.GroupType = GroupTypes.Token; this.Group = TokenGroup; Position = world.RandomPosition(); }
public Base(World world, CaptureTheFlag captureTheFlag, Vector2 position, Team team) : base(world) { this.Team = team; this.Position = position; this.Sprite = Sprites.ctf_base; this.AngularVelocity = SPEED_STOPPED; this.Size = 200; this.CaptureTheFlag = captureTheFlag; this.BaseGroup = new ActorGroup(world); BaseGroup.ZIndex = 50; this.Group = BaseGroup; }
public Base(CaptureTheFlag captureTheFlag, Vector2 position, Team team) { this.Team = team; this.Position = position; this.Sprite = Sprites.ctf_base; this.AngularVelocity = SPEED_STOPPED; this.Size = 200; this.CaptureTheFlag = captureTheFlag; CausesCollisions = true; this.BaseGroup = new ActorGroup(); BaseGroup.Init(captureTheFlag.World); this.Group = BaseGroup; }
public IActorGroup <TActor> GetGroup <TActor>() where TActor : Actor { var actorTypeId = Typeof <TActor> .Id; IActorGroup actorGroup; using (Lock.Enter(_groups)) { // ReSharper disable once InvertIf if (!_groups.TryGetValue(actorTypeId, out actorGroup)) { actorGroup = new ActorGroup <TActor>(this); _groups.Add(actorTypeId, actorGroup); } } return((IActorGroup <TActor>)actorGroup); }
/// <see cref="IConcertRepository.SaveGroup" /> public ActorGroup SaveGroup(ActorGroup model) { if (model.Id == 0) { db.Entry(model).State = EntityState.Added; } else if (model.Id > 0) { var pr = db.ActorGroups.FirstOrDefault(o => o.Id == model.Id); db.Entry(pr).CurrentValues.SetValues(model); } try { db.SaveChanges(); } catch (Exception e) { return(null); } return(model); }
public static ActorBehaviour CreateActorBehaviour(string fileName, GameObject model, ActorType eType, ActorGroup actorGroup, uint actorID) { GameObject obj = new GameObject(fileName); if (model != null) { model.transform.parent = obj.transform; model.transform.localPosition = Vector3.zero; model.transform.localScale = Vector3.one; } ActorBehaviour refActorBehaviour = null; switch (eType) { case ActorType.NONE: break; case ActorType.HERO: break; case ActorType.MONSTER: break; case ActorType.SCENE_OBJ: break; case ActorType.SCENE_SKILLDESTROY_OBJ: break; case ActorType.VIRSUAL_OBJ: refActorBehaviour = Utils.AddMissComponent <ActorBehaviour_Virsual>(obj); break; case ActorType.NONATTACK_OBJ: break; case ActorType.TEST_OBJ: refActorBehaviour = Utils.AddMissComponent <ActorBehaviour_Test>(obj); break; case ActorType.COUNT: break; default: break; } if (refActorBehaviour == null) { return(null); } refActorBehaviour.Init(model, eType, actorGroup, actorID); return(refActorBehaviour); }
public ActorBehaviour CreateActor(Property property, ActorType eType, ActorGroup Group) { return(null); }
public void AddGroup(ActorGroup group) { this.groups.Add(group); group.Add(this); }
private static ActorGroup CreateActors(XiGame game) { ActorGroup actors = new ActorGroup(game); actors.RefreshOverlaidProperties(); return actors; }
public void Open(string fileName) { XiHelper.ArgumentNullCheck(fileName); actors.Dispose(); try { actors = game.ReadRecyclable<ActorGroup>(fileName); } catch { actors = new ActorGroup(game); throw; } game.RaiseSimulationStructureChanged(); }
public ActorBehaviour CreateActor(uint actorID, ActorType eType, ActorGroup Group) { return(CreateActorGameObject(actorID, eType, Group)); }
public Property MyProperty; //基础属性 public void Init(ActorType eType, ActorGroup actorGroup, uint actorID = 0) { ActorType = eType; ActorGroup = actorGroup; ActorID = actorID; }
/// <summary> /// 创建ActorBehaviour /// </summary> /// <param name="actorID">角色ID,读表用,不唯一</param> /// <param name="actorType"></param> /// <param name="prefab_path"> 测试用,正式用actorID创建</param> /// <returns></returns> ActorBehaviour CreateActorGameObject(uint actorID, ActorType actorType, ActorGroup actorGroup, string prefab_path = "", Property property = new Property()) { GameObject model = null; switch (actorType) { case ActorType.NONE: break; case ActorType.HERO: model = CreateHeroGameObject(actorID); break; case ActorType.MONSTER: model = CreateMonsterGameObject(actorID); break; case ActorType.SCENE_OBJ: break; case ActorType.TEST_OBJ: model = CreateGameObjectByPrefabPath(prefab_path, FileNameType.RESOURCE_NAME); break; case ActorType.SCENE_SKILLDESTROY_OBJ: break; case ActorType.VIRSUAL_OBJ: break; case ActorType.NONATTACK_OBJ: break; case ActorType.COUNT: break; default: break; } if (model == null && actorType != ActorType.VIRSUAL_OBJ) { Debug.Log(string.Format("create actor Error , actorID :{0} , ActorType :{1}", actorID, actorType)); return(null); } string modelName = model == null ? "VIRSUAL" : model.name; string fileName = string.Format("[{0}].{1}.{2}", actorType, actorID, modelName); ActorBehaviour refActor = ActorBehaviour.CreateActorBehaviour(fileName, model, actorType, actorGroup, actorID); if (refActor != null) { if (!_actorsDic.ContainsKey(refActor.UID)) { _actorsDic.Add(refActor.UID, refActor); } else { Debug.LogError("contain object"); refActor.RemoveSelf(); GameObject.Destroy(refActor.gameObject); } } return(refActor); }
/// <summary> /// 一般测试用 /// </summary> /// <param name="prefab_path"></param> /// <param name="eType"></param> /// <param name="Group"></param> /// <returns></returns> public ActorBehaviour CreateActor(string prefab_path, Property property, ActorType eType, ActorGroup Group) { return(CreateActorGameObject(0, eType, Group, prefab_path, property)); }