public void EntityDestroyed(Game.Entity e) { Debug.Log("Destroying " + e.modelName); var mirror = entityToUnity[e]; entityToUnity.Remove(e); mirror.Destroyed(); }
public void EntityCreated(Game.Entity e) { var minimap_go = Instantiate(minimapDot); minimap_go.transform.SetParent(minimapContainerTransform, false); var minimap_dot = minimap_go.GetComponent <UnityInterwork.MinimapDot>(); minimap_dot.entity = e; minimap_dot.controller = minimapController; entityToMinimap.Add(e, minimap_dot); }
public void EntityCreated(Game.Entity e) { var prefab = Resources.Load <GameObject>("Models/" + e.modelName); Debug.Log("Created " + e.modelName + " prefab is " + prefab); var go = Instantiate(prefab); var mirror = go.GetComponent <UnityInterwork.EntityMirror>(); mirror.entity = e; mirror.positionAdjust = new Vector3(0, 0, 0); entityToUnity.Add(e, mirror); }
// Commit pending commands to the game world. void IssuePendingCommands() { foreach (var cmd in pendingCommands) { var entity = Game.World.current.IdToEntity(cmd.entityId); if (entity == null) { continue; } if (checkTeam && entity.team != cmd.teamId) { // Teams don't match, skip. continue; } Game.Entity target = null; if (cmd.targetId != 0) { target = Game.World.current.IdToEntity(cmd.targetId); if (target == null) { continue; } } switch (cmd.type) { case NetworkMessage.Type.CommandStop: entity.StopCommand(); break; case NetworkMessage.Type.CommandMove: entity.MoveCommand(cmd.position); break; case NetworkMessage.Type.CommandAttack: entity.AttackCommand(target); break; case NetworkMessage.Type.CommandDeploy: entity.DeployCommand(cmd.position); break; case NetworkMessage.Type.CommandBuild: entity.BuildCommand(cmd.buildId, cmd.position); break; } } pendingCommands.Clear(); var x = pendingCommands; pendingCommands = pendingFutureCommands; pendingFutureCommands = x; }
void HitscanEffect(Game.HitscanWeapon weapon, string effectName, Game.Entity target, float duration) { GameObject effectPrefab = Resources.Load <GameObject>("HitscanEffects/" + effectName); for (var x = -1; x <= 1; x += 1) { for (var z = -1; z <= 1; z += 1) { var go = Instantiate(effectPrefab, (Vector3)weapon.entity.position, Quaternion.identity); var effect = go.GetComponent <HitscanEffect>(); effect.weapon = weapon; effect.target = target; effect.duration = duration; effect.positionAdjust = new Vector3(x * 1024, 0, z * 1024); } } }
public void HitscanSustainedFire(Game.HitscanWeapon weapon, string effect, Game.Entity target, Game.DReal duration) { HitscanEffect(weapon, effect, target, (float)duration); }
public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target) { HitscanEffect(weapon, effect, target, -1); }
public void Animate(Game.Entity e, string animation) { }
public void HitscanSustainedFire(Game.HitscanWeapon weapon, string effect, Game.Entity target, Game.DReal duration) { }
public void EntityDestroyed(Game.Entity e) { Debug.Log("Destroying " + e.modelName); worldManager.EntityDestroyed(e); minimapManager.EntityDestroyed(e); }
public void EntityDestroyed(Game.Entity e) { Destroy(entityToMinimap[e].gameObject); entityToMinimap.Remove(e); }
public void Animate(Game.Entity e, string animation) { worldManager.Animate(e, animation); minimapManager.Animate(e, animation); }
public void HitscanSustainedFire(Game.HitscanWeapon weapon, string effect, Game.Entity target, Game.DReal duration) { worldManager.HitscanSustainedFire(weapon, effect, target, duration); minimapManager.HitscanSustainedFire(weapon, effect, target, duration); }
public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target) { worldManager.HitscanBurstFire(weapon, effect, target); minimapManager.HitscanBurstFire(weapon, effect, target); }
public void Animate(Game.Entity e, string animation) { entityToUnity[e].Animate(animation); }
public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target) { }
public void EntityCreated(Game.Entity e) { worldManager.EntityCreated(e); minimapManager.EntityCreated(e); }