Ejemplo n.º 1
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);
            }
        }
    }
Ejemplo n.º 2
0
 public void HitscanSustainedFire(Game.HitscanWeapon weapon, string effect, Game.Entity target, Game.DReal duration)
 {
     HitscanEffect(weapon, effect, target, (float)duration);
 }
Ejemplo n.º 3
0
 public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target)
 {
     HitscanEffect(weapon, effect, target, -1);
 }
Ejemplo n.º 4
0
 public void HitscanSustainedFire(Game.HitscanWeapon weapon, string effect, Game.Entity target, Game.DReal duration)
 {
 }
Ejemplo n.º 5
0
 public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target)
 {
 }
Ejemplo n.º 6
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);
 }
Ejemplo n.º 7
0
 public void HitscanBurstFire(Game.HitscanWeapon weapon, string effect, Game.Entity target)
 {
     worldManager.HitscanBurstFire(weapon, effect, target);
     minimapManager.HitscanBurstFire(weapon, effect, target);
 }
Ejemplo n.º 8
0
        public Entity Instantiate(string prototypeName, int team, DVector3 position)
        {
            var proto = entityPrototypes[prototypeName];
            var ent   = new Entity(team, position, proto);

            foreach (var cproto in proto.components)
            {
                Component comp = null;
                if (cproto.kind == "Wizard")
                {
                    comp = new Wizard(ent, cproto);
                }
                else if (cproto.kind == "WizardTower")
                {
                    comp = new WizardTower(ent, cproto);
                }
                else if (cproto.kind == "BasicUnit")
                {
                    comp = new BasicUnit(ent, cproto);
                }
                else if (cproto.kind == "GroundMotor")
                {
                    comp = new GroundMotor(ent, cproto);
                }
                else if (cproto.kind == "AirMotor")
                {
                    comp = new AirMotor(ent, cproto);
                }
                else if (cproto.kind == "ResourceCollectionPoint")
                {
                    comp = new ResourceCollectionPoint(ent, cproto);
                }
                else if (cproto.kind == "ResourceHarvester")
                {
                    comp = new ResourceHarvester(ent, cproto);
                }
                else if (cproto.kind == "Truck")
                {
                    comp = new Truck(ent, cproto);
                }
                else if (cproto.kind == "MineTruck")
                {
                    comp = new MineTruck(ent, cproto);
                }
                else if (cproto.kind == "Mine")
                {
                    comp = new Mine(ent, cproto);
                }
                else if (cproto.kind == "Factory")
                {
                    comp = new Factory(ent, cproto);
                }
                else if (cproto.kind == "ResourceSource")
                {
                    comp = new ResourceSource(ent, cproto);
                }
                else if (cproto.kind == "ProjectileWeapon")
                {
                    comp = new ProjectileWeapon(ent, cproto);
                }
                else if (cproto.kind == "Projectile")
                {
                    comp = new Projectile(ent, cproto);
                }
                else if (cproto.kind == "Collider")
                {
                    comp = new Collider(ent, cproto);
                }
                else if (cproto.kind == "HitscanWeapon")
                {
                    comp = new HitscanWeapon(ent, cproto);
                }
                else if (cproto.kind == "Health")
                {
                    comp = new Health(ent, cproto);
                }
                else if (cproto.kind == "BuildRadius")
                {
                    comp = new BuildRadius(ent, cproto);
                }
                else if (cproto.kind == "Team")
                {
                    comp = new Team(ent, cproto);
                }
                else if (cproto.kind == "ResourcePool")
                {
                    comp = new ResourcePool(ent, cproto);
                }
                else
                {
                    Logger.Log("Unknown component type {0}", cproto.kind);
                }
                ent.AddComponent(comp);
            }
            return(ent);
        }