public BaseState(Events.SpawnEvent e) { Position = e.Position; Side = e.Side; LaneKey = e.LaneKey; Angle = e.Angle; }
private void _spawnSoldier(int laneIndex, Side side) { var pos = Map.GetSoldierSpawnPosition(laneIndex, side); var e = new Events.SpawnEvent(pos, 0, side, laneIndex.ToString(), ObjectType.UnitSoldier); Game.PushEvent(e); }
public static void Spawn(Events.SpawnEvent e, GameState privateState) { var objectState = _getStateForSpawnEvent(e); var position = M.SetZ(e.Position, ParticleConsts.Z); _updateInternalState(e.ObjectType, objectState, privateState); FactoryBehaviour.SpawnPrefab(position, e.ObjectType, objectState); }
private void _produceResources() { State.ProductionCooldown -= Time.deltaTime; if (State.ProductionCooldown < 0 && State.Side != Side.Neutral) { State.ProductionCooldown = BalanceConsts.ControlPointProductionCooldown; Game.PushEvent(new Events.ProduceResourceEvent(State.Id)); if (State.Side == Side.Player) { var e = new Events.SpawnEvent(State.Position, ObjectType.ParticleResource); Game.PushEvent(e); } } }
private static BaseState _getStateForSpawnEvent(Events.SpawnEvent e) { switch (e.ObjectType) { // Units case ObjectType.UnitControlPoint: return(new ControlPointState(e)); case ObjectType.UnitSoldier: return(new SoldierState(e)); case ObjectType.UnitTurret: return(new TurretState(e)); // Map + Scenery case ObjectType.MapBarrier: return(new BarrierState(e)); // Misc case ObjectType.EnemyAI: return(new EnemyAIState()); // Decal case ObjectType.DecalBlood: return(new DecalState(e, DecalType.Blood)); case ObjectType.DecalExplosion: return(new DecalState(e, DecalType.Scorch)); case ObjectType.DecalBullet: return(new DecalState(e, DecalType.Bullet)); // Lights case ObjectType.LightMuzzle: return(new LightGlowState(e, LightGlowType.Muzzle)); case ObjectType.LightExplosion: return(new LightGlowState(e, LightGlowType.Explosion)); case ObjectType.LightTurretMuzzle: return(new LightGlowState(e, LightGlowType.TurretMuzzle)); // Particles default: return(null); } }
private void _produceResources() { State.ProductionCooldown -= Time.deltaTime; if (State.ProductionCooldown <= 0f) { State.ProductionCooldown = BalanceConsts.ControlPointProductionCooldown; Game.PushEvent(new Events.ProduceResourceEvent(State.Id)); if (State.Side == Side.Player) { var laneIndex = Int32.Parse(State.LaneKey); var e = new Events.SpawnEvent(Map.GetSoldierSpawnPosition(laneIndex, State.Side), ObjectType.ParticleResource); Game.PushEvent(e); } } }
public ControlPointState(Events.SpawnEvent e) : base(e) { UnitType = UnitType.ControlPoint; }
public BaseUnitState(Events.SpawnEvent e) : base(e) { Angle = e.Angle; }
public LightGlowState(Events.SpawnEvent e, LightGlowType type) : base(e) { LightGlowType = type; }
public DecalState(Events.SpawnEvent e, DecalType type) : base(e) { DecalType = type; }
public BarrierState(Events.SpawnEvent e) : base(e) { }
public TurretState(Events.SpawnEvent e) : base(e) { Health = BalanceConsts.TurretHealth; UnitType = UnitType.Turret; ProductionCooldown = BalanceConsts.ControlPointProductionCooldown * (0.8f + 0.2f * Random.value); }
public SoldierState(Events.SpawnEvent e) : base(e) { Health = BalanceConsts.SoldierHealth; UnitType = UnitType.Soldier; }