Exemple #1
0
    public void EntityDestroyed(Game.Entity e)
    {
        Debug.Log("Destroying " + e.modelName);
        var mirror = entityToUnity[e];

        entityToUnity.Remove(e);
        mirror.Destroyed();
    }
Exemple #2
0
    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);
    }
Exemple #3
0
    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);
    }
Exemple #4
0
    // 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;
    }
Exemple #5
0
    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);
            }
        }
    }
Exemple #6
0
 public void HitscanSustainedFire(Game.HitscanWeapon weapon, string effect, Game.Entity target, Game.DReal duration)
 {
     HitscanEffect(weapon, effect, target, (float)duration);
 }
Exemple #7
0
 public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target)
 {
     HitscanEffect(weapon, effect, target, -1);
 }
Exemple #8
0
 public void Animate(Game.Entity e, string animation)
 {
 }
Exemple #9
0
 public void HitscanSustainedFire(Game.HitscanWeapon weapon, string effect, Game.Entity target, Game.DReal duration)
 {
 }
Exemple #10
0
 public void EntityDestroyed(Game.Entity e)
 {
     Debug.Log("Destroying " + e.modelName);
     worldManager.EntityDestroyed(e);
     minimapManager.EntityDestroyed(e);
 }
Exemple #11
0
 public void EntityDestroyed(Game.Entity e)
 {
     Destroy(entityToMinimap[e].gameObject);
     entityToMinimap.Remove(e);
 }
Exemple #12
0
 public void Animate(Game.Entity e, string animation)
 {
     worldManager.Animate(e, animation);
     minimapManager.Animate(e, animation);
 }
Exemple #13
0
 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);
 }
Exemple #14
0
 public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target)
 {
     worldManager.HitscanBurstFire(weapon, effect, target);
     minimapManager.HitscanBurstFire(weapon, effect, target);
 }
Exemple #15
0
 public void Animate(Game.Entity e, string animation)
 {
     entityToUnity[e].Animate(animation);
 }
Exemple #16
0
 public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target)
 {
 }
Exemple #17
0
 public void EntityCreated(Game.Entity e)
 {
     worldManager.EntityCreated(e);
     minimapManager.EntityCreated(e);
 }