Exemplo n.º 1
0
	public void SetType (WeaponType wt) {
		_type = wt;
		if (type == WeaponType.none) {
			this.gameObject.SetActive (false);
			return;
		} else {
			this.gameObject.SetActive (true);
		}
		def = Main.GetWeaponDefinition (_type);
		collar.renderer.material.color = def.color;
		lastShot = 0; //You can always fire immediately after _type is set
	}
Exemplo n.º 2
0
    public void SetType(WeaponType wt)
    {
        _type = wt;

        if (type == WeaponType.none)
        {                                       // e
            this.gameObject.SetActive(false);

            return;
        }
        else
        {
            this.gameObject.SetActive(true);
        }

        def = Main.GetWeaponDefinition(_type);                               // f

        collarRend.material.color = def.color;

        lastShotTime = 0; // You can fire immediately after _type is set.    // g
    }
Exemplo n.º 3
0
    public void Shoot()
    {
        if (currentWeapon != null && (cameraController == null || cameraController.ActiveCamera.AllowShooting))
        {
            WeaponDefinition definition = currentWeapon.Definition;;
            float            aimBound   = Camera.main.pixelHeight * definition.Dispersion;

            for (int i = 0; i < definition.ProjectilesPerShot; i++)
            {
                Vector2      shotOrigin  = Random.insideUnitCircle * aimBound;
                Vector3      screenPoint = new Vector3(Camera.main.pixelWidth / 2 + shotOrigin.x, Camera.main.scaledPixelHeight / 2 + shotOrigin.y, 0);
                Ray          ray         = Camera.main.ScreenPointToRay(screenPoint);
                RaycastHit[] hits        = Physics.RaycastAll(ray, 100, shootMask);

                LineRenderer line = Instantiate(bulletTrailPrefab);
                line.SetPosition(0, currentWeapon.Muzzle.position);

                if (hits.Length > 0)
                {
                    RaycastHit firstHit = hits[0];

                    Health health = firstHit.collider.GetComponent <Health>();
                    health.Hurt(definition.DamagePerProjectile, firstHit.point, firstHit.normal, gameObject);

                    line.SetPosition(1, firstHit.point);
                }
                else
                {
                    line.SetPosition(1, ray.origin + ray.direction.normalized * 100);
                }
            }

            shootLight.transform.position = currentWeapon.Muzzle.position;
            shootLight.gameObject.SetActive(true);

            currentWeapon.LastShotTime = Time.time;
            lastShootTime = Time.time;
        }
    }
    public void SetType(WeaponType wt)
    {
        _type = wt;

        if (type == WeaponType.none)
        {
            this.gameObject.SetActive(false);

            return;
        }

        else
        {
            this.gameObject.SetActive(true);
        }

        def = Main.GetWeaponDefinition(_type);

        collarRend.material.color = def.color;

        lastShotTime = 0;
    }
Exemplo n.º 5
0
    public void SetType(WeaponType wt)
    {
        _type = wt;
        if (type == WeaponType.none)
        {
            this.gameObject.SetActive(false); //hides the gun if the weapon is none
        }
        else
        {
            this.gameObject.SetActive(true); //show gun if there is a weapon enabled
        }

        GameObject rootGo = transform.root.gameObject;

        if (rootGo.GetComponent <Hero_Script>() != null)
        {
            if (wt != WeaponType.plasmaThrower)
            {
                _plasmaThrowerParticles.enabled = false;                        //incase of switch while space is being held
                rootGo.GetComponent <Hero_Script>().FireWeaponsDelegate = Fire; //assigning fire the the function delegate
                rootGo.GetComponent <Hero_Script>().StopWeaponsFire     = null; //when not using plasma thrower no need to stop weapons fire
            }
            else
            {
                rootGo.GetComponent <Hero_Script>().FireWeaponsDelegate = FirePlasmaThrower; //different fire function for flame thrower
                rootGo.GetComponent <Hero_Script>().StopWeaponsFire     = StopPlasmaThrower; //there is a function to be triggered when space bar is lifted
            }
        }
        else if (rootGo.GetComponent <Enemy_3_Movement>() != null) //attach fire to enemy 3
        {
            rootGo.GetComponent <Enemy_3_Movement>().FireWeaponsDelegate = Fire;
        }
        else if (rootGo.GetComponent <Enemy_Boss_Movement>() != null) //attach multiple fire to boss
        {
            rootGo.GetComponent <Enemy_Boss_Movement>().FireWeaponsDelegate += Fire;
        }
        def          = Main_MainScene.GetWeaponDefinition(_type);
        lastShotTime = 0; //this means that weapon will be ready to fire right when it is switched to
    }
        public void testSerialization()
        {
            Dictionary <RarityObject.Rarity, WeaponDefinition> dict = new Dictionary <RarityObject.Rarity, WeaponDefinition>();

            WeaponDefinition wd = new WeaponDefinition();

            wd.name          = "test";
            wd.minimumDamage = 1.1f;
            wd.maximumDamage = 3.4f;
            wd.damageType    = WeaponDefinition.DamageType.BALLISTIC;
            wd.rarity        = RarityObject.Rarity.RARE;

            dict.Add(RarityObject.Rarity.LEGENDARY, wd);

            string json = JsonConvert.SerializeObject(dict, Formatting.Indented);

            Debug.Log(json);

            Dictionary <RarityObject.Rarity, WeaponDefinition> dict2 = new Dictionary <RarityObject.Rarity, WeaponDefinition>();

            dict2 = JsonConvert.DeserializeObject <Dictionary <RarityObject.Rarity, WeaponDefinition> >(json);
        }
Exemplo n.º 7
0
     }//public WeaponType type


     /*************************************************************************************************
     *** Methods
     *************************************************************************************************/
     public void SetType(WeaponType wt)
     {
          _type = wt;
          if (type == WeaponType.none)
          {
               gameObject.SetActive(false);
               return;

          }
          else
          {
               gameObject.SetActive(true);

          }//if else

          def = Main.GetWeaponDefinition(_type);
          collar.GetComponent<Renderer>().material.color = def.color;

          //You can always fire inmediately after _type is set
          lastShot = 0;

     }//public void SetType
Exemplo n.º 8
0
    void SwapWeapons(int dir)
    {
        int index = weapons.IndexOf(weapon);

        if (index + dir < 0)
        {
            weapon = weapons[weapons.Count - 1];
        }

        else if (index + dir > weapons.Count - 1)
        {
            weapon = weapons[0];
        }

        else
        {
            weapon = weapons[index + dir];
        }

        UI.S.weaponName.text = weapon.GetName();
        if (weapon.GetType() != Weapon.WeaponType.ePistol && weapon.GetType() != Weapon.WeaponType.eSniperRifle)
        {
            UI.S.ammo.text = weapon.GetCurrentAmmo() + "/" + weapon.GetCapacity() + "  [" + _rifleAmmo + "]";
        }
        else if (weapon.GetType() == Weapon.WeaponType.eSniperRifle)
        {
            UI.S.ammo.text = weapon.GetCurrentAmmo() + "/" + weapon.GetCapacity() + "  [" + _sniperAmmo + "]";
        }
        else
        {
            UI.S.ammo.text = weapon.GetCurrentAmmo() + "/" + weapon.GetCapacity();
        }

        if (!Main.S.isEnableToShoot)
        {
            UI.S.SetAmmoTexts();
        }
    }
Exemplo n.º 9
0
    public bool AddWeapon(WeaponType weapon)
    {
        Debug.Log("Add weapon of type: " + weapon.ToString());
        Weapon weaponInstance;
        bool   hasWeapon = currentWeapons.TryGetValue(weapon, out weaponInstance);

        if (!hasWeapon)
        {
            // Get definition
            WeaponDefinition wd = GameObject.FindObjectOfType <XMLReader>().GetWeaponDefinition(weapon);
            if (wd != null)
            {
                weaponInstance            = this.gameObject.AddComponent <Weapon>();
                weaponInstance.weaponType = weapon;
                weaponInstance.weaponName = wd.WeaponName;

                var values = AmmunitionType.GetValues(typeof(AmmunitionType));

                foreach (AmmunitionType ammo in values)
                {
                    if (ammo.ToString() == wd.AmmoType)
                    {
                        weaponInstance.ammoType = ammo;
                    }
                }
                weaponInstance.oneShotAmmoNeed = wd.OneShotAmmoNeed;
                weaponInstance.force           = wd.Force;
                weaponInstance.cooldownTime    = wd.CooldownTime;
                currentWeapons.Add(weapon, weaponInstance);

                return(true);
            }
        }

        return(false);
    }
Exemplo n.º 10
0
 private void Initialize(WeaponDefinition weapon, IGameActor owner, uint projectileId)
 {
     MyWeaponData      = weapon;
     MyOwner           = owner;
     RemainingLifetime = weapon.lifetime;
     RemainingHits     = weapon.maximumEnemiesHit;
     MyId = projectileId;
     if (weapon.projectileLockedEffect != null)
     {
         spawnedEffect = CosmeticEffect.Spawn(weapon.projectileLockedEffect, weapon.lifetime, transform.position, transform.rotation, this.transform);
         dummyRenderer.SetActive(false);
     }
     else
     {
         dummyRenderer.SetActive(!weapon.hiddenAttack);
     }
     // Don't spawn the actorsHitByProjectile array until it actually hits something.
     if (weapon.reflectsOtherAttacks)
     {
         reflectionCollider.gameObject.SetActive(true);
         reflectionCollider.radius = weapon.radius;
         reflectingColliders[reflectionCollider] = MyOwner;
     }
 }
Exemplo n.º 11
0
 public void SetType(WeaponType wt)
 {
     _type = wt;
     if (type == WeaponType.none)
     {
         this.gameObject.SetActive(false);
         return;
     }
     else
     {
         if (wt != WeaponType.laser || wt != WeaponType.enemyLaser)
         {
             if (laser) // if laser exist and the current type is not the laser, destroy the laser
             {
                 laserStarted = false;
                 Destroy(laser.gameObject);
             }
         }
         this.gameObject.SetActive(true);
     }
     def = Main.GetWeaponDefinition(_type);
     collarRend.material.color = def.color;
     lastShotTime = 0; //You can fire immediately after _type is set
 }
Exemplo n.º 12
0
    public void ServerApplyHitscanShot(
        Server server, PlayerObjectComponent shootingPlayerObjectComponent,
        WeaponDefinition weaponDefinition, Ray shotRay
        )
    {
        var possibleHit = WeaponSystem.Instance.GetClosestValidRaycastHitForGunShot(shotRay, shootingPlayerObjectComponent);

        if (possibleHit != null)
        {
            var hit             = possibleHit.Value;
            var hitPlayerObject = hit.collider.gameObject.FindObjectOrAncestorWithTag(OsFps.PlayerTag);

            if ((hitPlayerObject != null) && (hitPlayerObject != shootingPlayerObjectComponent.gameObject))
            {
                var hitPlayerObjectComponent = hitPlayerObject.GetComponent <PlayerObjectComponent>();

                var isHeadShot = hit.collider.gameObject.name == OsFps.PlayerHeadColliderName;
                var damage     = !isHeadShot
                    ? weaponDefinition.DamagePerBullet
                    : weaponDefinition.HeadShotDamagePerBullet;
                ServerDamagePlayer(
                    server, hitPlayerObjectComponent, damage, shootingPlayerObjectComponent
                    );
            }

            if (hit.rigidbody != null)
            {
                hit.rigidbody.AddForceAtPosition(5 * shotRay.direction, hit.point, ForceMode.Impulse);
            }
        }

        if (OsFps.ShowHitScanShotsOnServer)
        {
            WeaponSystem.Instance.CreateHitScanShotDebugLine(shotRay, OsFps.Instance.ServerShotRayMaterial);
        }
    }
Exemplo n.º 13
0
        public void Setup()
        {
            var blocks = BlockHelper.GetBlocksOfType <IMyFunctionalBlock>(_remoteControl.SlimBlock.CubeGrid);

            //Logger.MsgDebug("WCAPI Ready: " + RAI_SessionCore.Instance.WeaponCore.IsReady.ToString(), DebugTypeEnum.Weapon);
            //Logger.MsgDebug(string.Format("All WC: {0} /// All WCS: {1} /// All WCT: {2}", Utilities.AllWeaponCoreBlocks.Count, Utilities.AllWeaponCoreGuns.Count, Utilities.AllWeaponCoreTurrets.Count), DebugTypeEnum.Weapon);

            foreach (var block in blocks)
            {
                IWeapon weapon = null;

                //Logger.MsgDebug(block.CustomName + " Has Core Weapon: " + RAI_SessionCore.Instance.WeaponCore.HasCoreWeapon(block).ToString(), DebugTypeEnum.Weapon);

                if (RAI_SessionCore.Instance.WeaponCoreLoaded && Utilities.AllWeaponCoreBlocks.Contains(block.SlimBlock.BlockDefinition.Id))
                {
                    var weaponsInBlock = new Dictionary <string, int>();
                    RAI_SessionCore.Instance.WeaponCore.GetBlockWeaponMap(block, weaponsInBlock);

                    foreach (var weaponName in weaponsInBlock.Keys)
                    {
                        WeaponDefinition weaponDef = new WeaponDefinition();

                        foreach (var definition in RAI_SessionCore.Instance.WeaponCore.WeaponDefinitions)
                        {
                            if (definition.HardPoint.WeaponName == weaponName)
                            {
                                weaponDef = definition;
                                break;
                            }
                        }

                        weapon = new CoreWeapon(block, _remoteControl, _behavior, weaponDef, weaponsInBlock[weaponName]);

                        if (!weapon.IsValid())
                        {
                            Logger.MsgDebug(block.CustomName + " Is Not Valid", DebugTypeEnum.BehaviorSetup);
                            continue;
                        }

                        Logger.MsgDebug(block.CustomName + " Is WeaponCore", DebugTypeEnum.BehaviorSetup);

                        if (weapon.IsStaticGun())
                        {
                            StaticWeapons.Add(weapon);
                        }
                        else
                        {
                            Turrets.Add(weapon);
                        }

                        continue;
                    }

                    RAI_SessionCore.Instance.WeaponCore.DisableRequiredPower(block);

                    continue;
                }
                else if (block as IMyLargeTurretBase != null || block as IMyUserControllableGun != null)
                {
                    weapon = new RegularWeapon(block, _remoteControl, _behavior);
                }
                else
                {
                    continue;
                }

                if (!weapon.IsValid())
                {
                    Logger.MsgDebug(block.CustomName + " Is Not Valid", DebugTypeEnum.BehaviorSetup);
                    continue;
                }

                Logger.MsgDebug(block.CustomName + " Is RegularWeapon", DebugTypeEnum.BehaviorSetup);

                if (weapon.IsStaticGun())
                {
                    StaticWeapons.Add(weapon);
                }
                else
                {
                    Turrets.Add(weapon);
                }
            }

            Logger.MsgDebug(string.Format("{0}: Weapons Registered - Static: {1} - Turret: {2}", _remoteControl.CubeGrid.CustomName, StaticWeapons.Count, Turrets.Count), DebugTypeEnum.BehaviorSetup);
        }
Exemplo n.º 14
0
 public static void WriteWeaponDefinition(this NetworkWriter writer, WeaponDefinition weaponDefinition)
 {
     // no need to serialize the data, just the name
     writer.WriteString(weaponDefinition.name);
 }
Exemplo n.º 15
0
 public bool CanChangeAmmoMagazine(MyDefinitionId newAmmoMagazineId)
 {
     return(WeaponDefinition.IsAmmoMagazineCompatible(newAmmoMagazineId));
 }
Exemplo n.º 16
0
    public static void upgradeWeapon(WeaponType t)
    {
        _type = t;

        def = Main.GetWeaponDefinition(_type);
    }
Exemplo n.º 17
0
        public WeaponCoreProfile(IMyRemoteControl remoteControl, IMyTerminalBlock block, WeaponDefinition definition, int id) : base(remoteControl, block)
        {
            IsWeaponCore          = true;
            _weaponCoreDefinition = definition;
            _weaponIndex          = id;

            if (_weaponCoreDefinition.Ammos.Length > 0)
            {
                int index = 0;

                for (int i = 0; i < _weaponCoreDefinition.Ammos.Length; i++)
                {
                    var definitionId = new MyDefinitionId(typeof(MyObjectBuilder_AmmoMagazine), _weaponCoreDefinition.Ammos[i].AmmoMagazine);

                    try {
                        var ammoDef = MyDefinitionManager.Static.GetAmmoMagazineDefinition(definitionId);

                        if (!_allAmmoMagazines.Contains(ammoDef))
                        {
                            _allAmmoMagazines.Add(ammoDef);
                        }
                    } catch (Exception e) {
                        Logger.MsgDebug("Could Not Get AmmoMagazine Definition From ID: " + definitionId.ToString(), DebugTypeEnum.Weapon);
                    }
                }

                if (_allAmmoMagazines.Count == 0)
                {
                    _weaponDefinitionHasNoAmmo = true;
                    _weaponValid = false;
                    return;
                }
                else
                {
                    Logger.MsgDebug("Total MyAmmoMagazineDefinition counts: " + _allAmmoMagazines.Count.ToString(), DebugTypeEnum.WeaponCore);
                }
            }
            else
            {
                _weaponDefinitionHasNoAmmo = true;
                _weaponValid = false;
                return;
            }

            OwnershipCheck(_weaponBlock);
        }
Exemplo n.º 18
0
 public WeaponCoreTurretProfile(IMyRemoteControl remoteControl, IMyTerminalBlock block, WeaponDefinition definition, int id) : base(remoteControl, block)
 {
 }
        public void testEnemyLoot()
        {
            Dictionary <RarityObject.Rarity, int>         rarities = new Dictionary <RarityObject.Rarity, int>();
            Dictionary <WeaponDefinition.WeaponType, int> wt       = new Dictionary <WeaponDefinition.WeaponType, int>();
            Dictionary <WeaponDefinition.DamageType, int> dt       = new Dictionary <WeaponDefinition.DamageType, int>();

            RandomLootGenerator rig = new RandomLootGenerator();

            for (int i = 0; i < totalTests; i++)
            {
                WeaponDefinition[] generatedItems = rig.generateLoot("jaffa");

                for (int j = 0; j < generatedItems.Length; j++)
                {
                    WeaponDefinition w = generatedItems[j];

                    if (w == null)
                    {
                        continue;
                    }

                    if (!rarities.ContainsKey(w.rarity))
                    {
                        rarities.Add(w.rarity, 1);
                    }
                    else
                    {
                        rarities[w.rarity] = rarities[w.rarity] + 1;
                    }


                    if (!wt.ContainsKey(w.weaponType))
                    {
                        wt.Add(w.weaponType, 1);
                    }
                    else
                    {
                        wt[w.weaponType] = wt[w.weaponType] + 1;
                    }


                    if (!dt.ContainsKey(w.damageType))
                    {
                        dt.Add(w.damageType, 1);
                    }
                    else
                    {
                        dt[w.damageType] = dt[w.damageType] + 1;
                    }

                    //Debug.Log(w.ToString());
                }
            }

            foreach (RarityObject.Rarity key in rarities.Keys)
            {
                Debug.Log("Key: " + key + ", Value: " + rarities[key]);
            }

            foreach (WeaponDefinition.WeaponType key in wt.Keys)
            {
                Debug.Log("Key: " + key + ", Value: " + wt[key]);
            }

            foreach (WeaponDefinition.DamageType key in dt.Keys)
            {
                Debug.Log("Key: " + key + ", Value: " + dt[key]);
            }
        }
Exemplo n.º 20
0
        public WeaponCoreStaticProfile(IMyRemoteControl remoteControl, IMyTerminalBlock block, WeaponDefinition definition, int id) : base(remoteControl, block, definition, id)
        {
            if (!_weaponValid)
            {
                return;
            }

            IsStatic = true;

            if (_remoteControl.WorldMatrix.Forward == _weaponBlock.WorldMatrix.Forward)
            {
                _isForwardFacingWeapon = true;
            }
        }
 public void SetType(WeaponType eType)
 {
     _type = eType;
     WeaponDefinition def = Main.GetWeaponDefinition(_type);
 }
Exemplo n.º 22
0
        public CoreWeapon(IMyTerminalBlock block, IMyRemoteControl remoteControl, IBehavior behavior, WeaponDefinition weaponDefinition, int weaponId) : base(block, remoteControl, behavior)
        {
            if (Utilities.AllWeaponCoreGuns.Contains(block.SlimBlock.BlockDefinition.Id))
            {
                Logger.MsgDebug(block.CustomName + " Is WeaponCore Static Weapon", DebugTypeEnum.Weapon);
                _isStatic = true;
            }
            else
            {
                Logger.MsgDebug(block.CustomName + " Is WeaponCore Turret Weapon", DebugTypeEnum.Weapon);
                _isTurret = true;
            }

            _weaponDefinition = weaponDefinition;
            _weaponId         = weaponId;

            //Rate Of Fire
            _rateOfFire = _weaponDefinition.HardPoint.Loading.RateOfFire;

            //Get Ammo Stuff

            Logger.MsgDebug(_block.CustomName + " Available Ammo Check", DebugTypeEnum.WeaponSetup);
            if (_weaponDefinition.Ammos.Length > 0)
            {
                foreach (var ammo in _weaponDefinition.Ammos)
                {
                    Logger.MsgDebug(string.Format(" - {0} / {1}", ammo.AmmoMagazine, ammo.AmmoRound), DebugTypeEnum.WeaponSetup);

                    if (!_ammoToMagazine.ContainsKey(ammo.AmmoRound))
                    {
                        _ammoToMagazine.Add(ammo.AmmoRound, new MyDefinitionId(typeof(MyObjectBuilder_AmmoMagazine), ammo.AmmoMagazine));
                    }

                    if (!_ammoToDefinition.ContainsKey(ammo.AmmoRound))
                    {
                        _ammoToDefinition.Add(ammo.AmmoRound, ammo);
                    }
                }
            }
            else
            {
                Logger.MsgDebug(_block.CustomName + " Has No WC Ammo Definitions", DebugTypeEnum.WeaponSetup);
                _isValid = false;
            }
        }
Exemplo n.º 23
0
    public void SetType(WeaponType eType)
    {
        _type = eType;
        WeaponDefinition def = Main.GetWeaponDefinition(_type);
//		rend.material.color = def.projectileColor;
    }
Exemplo n.º 24
0
	public void SetType(WeaponType wt){
		_type=wt;
		if (type==WeaponType.none){
			this.gameObject.SetActive (false);
			return;
		}
		else
			this.gameObject.SetActive (false);
		def = Main.GetWeaponDefinition (_type);
		collar.GetComponent<Renderer>().material.color=def.color;
		lastShot = 0;
	}
Exemplo n.º 25
0
 private static ITooltipDataProvider Create(WeaponDefinition weapon, int level)
 {
     return(new CharacterTooltipDataProvider <WeaponDefinition>(weapon, level));
 }
Exemplo n.º 26
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject otherGO = collision.gameObject;


        switch (otherGO.tag)
        {
        case "PlayerProjectile":
            if (!explosionStarted)     // check to see if this is enemy boss currently exploding, if not show & take damage
            {
                // Hurt this enemy
                ShowDamage();
                type = otherGO.GetComponent <Projectile>().Type;
                WeaponDefinition def = GameManager.GetWeaponDefinition(type);
                health -= def.damageOnHit;
            }

            if (health <= 0 && !dying)
            {
                dying = true;
                Die();
            }

            if (persistentBossHealth)
            {
                gameObject.GetComponentInParent <RandomWaveGenerator>().persistentBossHealth = health;
            }

            if (otherGO.tag == "PlayerProjectile")
            {
                Destroy(otherGO);
            }

            break;

        case "PlayerProjectileLaser":
            // Hurt this enemy
            ShowDamage();
            takingLaserDamage = true;
            type     = otherGO.GetComponent <Projectile>().Type;
            laserDef = GameManager.GetWeaponDefinition(type);

            break;

        case "Player":
            if (!Player.S.playerStarting)
            {
                health -= 10;

                Player.S.LoseLife();

                if (persistentBossHealth)
                {
                    gameObject.GetComponentInParent <RandomWaveGenerator>().persistentBossHealth = health;
                }

                if (health <= 0 && !dying)
                {
                    dying = true;
                    Die();
                }
            }
            break;

        default:
            break;
        }
    }
Exemplo n.º 27
0
        // // A Test behaves as an ordinary method
        // [Test]
        // public void WeaponTestsSimplePasses()
        // {
        //     // Use the Assert class to test conditions
        //     Debug.Log("Test");
        // }

        private void Init()
        {
            weapon = new GameObject("Test Player").AddComponent <Weapon>();
            // Use default values
            defaultWeapon = ScriptableObject.CreateInstance <WeaponDefinition>();
        }
Exemplo n.º 28
0
    public static void Spawn(Projectile prefab, WeaponDefinition weapon, IGameActor owner, Vector3 position, Quaternion rotation, uint projectileId)
    {
        Projectile spawnedProjectile = GameObject.Instantiate <Projectile>(prefab, position, rotation);

        spawnedProjectile.Initialize(weapon, owner, projectileId);
    }
Exemplo n.º 29
0
 public TeamMember(int rank, string forename, string surname,
                   WeaponDefinition primaryWeapon, WeaponDefinition secondaryWeapon, WeaponDefinition throwableWeapon, WeaponDefinition armour) : base(rank, forename, surname)
 {
     this.primaryWeapon   = primaryWeapon;
     this.secondaryWeapon = secondaryWeapon;
     this.throwableWeapon = throwableWeapon;
     this.armour          = armour;
 }
Exemplo n.º 30
0
 public bool TryGetCurrentWeapon(out WeaponDefinition weapon)
 {
     weapon = equippedWeapon;
     return(weapon != null);
 }
Exemplo n.º 31
0
 public void SetCurrentWeapon(WeaponDefinition weaponDefinition)
 {
     equippedWeapon = weaponDefinition;
 }
Exemplo n.º 32
0
 public Weapon(WeaponDefinition definition)
     : base(definition)
 {
     WeaponType = definition.WeaponType;
 }