Esempio n. 1
0
        private static void AddWeapon(uint id, uint uniqueNum, SubWeapon sub, SpecialWeapon special)
        {
            Weapon weapon = new Weapon(id, uniqueNum, sub, special);

            weapons.Add(weapon);
            idToIndex.Add(id, weapons.Count - 1);
        }
Esempio n. 2
0
    public void SpawnPU()
    {
        int chance = Random.Range(0, 1000);

        if (chance <= 750)
        {
            GameObject    go = GameObject.Instantiate(mPUResource);
            SpecialWeapon sw = go.GetComponent <SpecialWeapon>();

            int x = Random.Range(-60, 60);
            int y = Random.Range(-40, 40);

            go.transform.position = new Vector3(x, 40, y);

            int wep = Random.Range(0, 3);

            if (wep == 0)
            {
                sw.m_weaponType = SPECIAL_WEAPON.MISSILE;
                sw.ammoCount    = 1;
            }
            else if (wep == 1)
            {
                sw.m_weaponType = SPECIAL_WEAPON.MINE;
                sw.ammoCount    = 3;
            }
            else if (wep == 2)
            {
                sw.m_weaponType = SPECIAL_WEAPON.SPEED_BOOST;
                sw.ammoCount    = 3;
            }
        }
    }
Esempio n. 3
0
 public Weapon(uint id, uint number, SubWeapon sub, SpecialWeapon special, uint inked, uint timestamp, bool isNew)
 {
     Id = id;
     WeaponSpecificNumber = number;
     SubWeapon            = sub;
     SpecialWeapon1       = special;
     TurfInked            = inked;
     LastUsageTimestamp   = timestamp;
     IsNew = isNew;
 }
Esempio n. 4
0
 public Weapon(uint id, uint number, SubWeapon sub, SpecialWeapon special)
 {
     Id = id;
     WeaponSpecificNumber = number;
     SubWeapon            = sub;
     SpecialWeapon1       = special;
     TurfInked            = 0;
     LastUsageTimestamp   = 0;
     IsNew = true;
 }
Esempio n. 5
0
        /// <summary>
        /// 武器チェンジアニメーションが終わった時に呼ぶ
        /// </summary>
        public void SetWeapon(int weaponType)
        {
            if (weaponType == (int)WEAPON_TYPE.HANDGUN || weaponType == (int)WEAPON_TYPE.NONE)
            {
                return;
            }

            Weapon        = Instantiate(_weponManager.WeaponPrefabList[weaponType], cameraTransform_).GetComponent <Weapon.SpecialWeapon>();
            WeaponList[2] = Weapon;
        }
Esempio n. 6
0
 public Weapon(uint id, uint number, SubWeapon sub, SpecialWeapon special, uint inked, uint timestamp, bool isNew)
 {
     this.id = id;
     weaponSpecificNumber = number;
     subWeapon            = sub;
     specialWeapon        = special;
     turfInked            = inked;
     lastUsageTimestamp   = timestamp;
     this.isNew           = isNew;
 }
Esempio n. 7
0
 public Weapon(uint id, uint number, SubWeapon sub, SpecialWeapon special)
 {
     this.id = id;
     weaponSpecificNumber = number;
     subWeapon            = sub;
     specialWeapon        = special;
     turfInked            = 0;
     lastUsageTimestamp   = 0;
     isNew = true;
 }
Esempio n. 8
0
 public static void SetPlayerWeapon(int id, bool isPlayerOne)
 {
     if (isPlayerOne)
     {
         selectedWeapon1 = (SpecialWeapon)id;
     }
     else
     {
         selectedWeapon2 = (SpecialWeapon)id;
     }
 }
Esempio n. 9
0
 public void SpinUpWeapon(SpecialWeapon weapon)
 {
     for (int i = 0; i < specialWeaponSilos.Length; i++)
     {
         if (!specialWeapons.Contains(i))
         {
             //slot is free, load the weapon and start spinup
             Silo       silo             = specialWeaponSilos[i].GetComponent <Silo>();
             GameObject spinningUpWeapon = Instantiate(weapon.prefab,
                                                       silo.launchPoint.position,
                                                       silo.launchPoint.rotation,
                                                       silo.launchPoint.transform);
             spinningUpWeapon.GetComponent <SpecialWeapon>().SetSiloIndex(i, silo);
         }
     }
 }
Esempio n. 10
0
        private void ReloadWeaponsList()
        {
            weapons.Clear();

            equippedWeapon = gecko.peek(Form1.equippedWeaponAddress + diff);

            // dump all weapon save slots
            uint[] weaponData = Form1.DumpSaveSlots(gecko, diff, Form1.weaponsAddress, 5120);

            // read data from slots
            int j = 0;

            while (j < weaponData.Length)
            {
                uint id = weaponData[j];

                // check if an empty save slot
                if (id == 0xFFFFFFFF)
                {
                    // we've reached the end
                    break;
                }

                uint          number    = weaponData[j + 1];
                SubWeapon     sub       = (SubWeapon)weaponData[j + 2];
                SpecialWeapon special   = (SpecialWeapon)weaponData[j + 3];
                uint          turfInked = weaponData[j + 4];
                uint          timestamp = weaponData[j + 7];
                bool          newFlag   = weaponData[j + 8] == 0x0;

                weapons.Add(new Weapon(id, number, sub, special, turfInked, timestamp, newFlag));

                // move to next slot
                j += 10;
            }

            // reload the list
            ReloadListBox();
        }
Esempio n. 11
0
 public static int SpecialWeaponToID(SpecialWeapon weapon)
 {
     return((int)weapon + 1);
 }
    void Update()
    {
        if (Time.timeScale == 1) {
            int i = fireLevel;
            i = (i > numberOfSpawn) ? numberOfSpawn : i;

            if (Input.GetKey(dataController.GetKeyInput(Constants.KEYMAINATTACK))) {
                if (!isFocus && Time.time > nextFire) {
                    nextFire = Time.time + fireRate;

                    arsenal.Fire (mainShotSpawn, fireType, gameObject.tag);

                    for (; i>= 0; --i) {
                        shotSpawnLeft[i].rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f);
                        shotSpawnRight[i].rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f);

                        arsenal.Fire (shotSpawnLeft[i], fireType, gameObject.tag);
                        arsenal.Fire (shotSpawnRight[i], fireType, gameObject.tag);
                    }
                } else if (isFocus && energy - 4 > 0 && Time.time > nextRegen) {
                    amountEnergy = -10f;
                    energy = energy - 10;

                    nextRegen = Time.time + regenRate;
                    if (specialShot == null) {
                        specialShot = arsenal.SpecialFire (gameObject, fireSpecialType);
                        swScript = specialShot.GetComponent<SpecialWeapon> ();
                    }
                    swScript.FillUp ();
                }
            } else if (Input.GetKey(dataController.GetKeyInput(Constants.KEYALTATTACK)) && Time.time > nextFire) {
                nextFire = Time.time + fireRate;

                int magnitudeX = (isFocus) ? 0 : 5;

                arsenal.Fire (mainShotSpawn, fireType, gameObject.tag);

                for (; i>= 0; --i) {
                    shotSpawnLeft[i].LookAt(new Vector3(transform.position.x + (-1 * magnitudeX * (i+1)),0,zPosition));
                    shotSpawnRight[i].LookAt(new Vector3(transform.position.x + (magnitudeX * (i+1)),0,zPosition));

                    arsenal.Fire (shotSpawnLeft[i], fireType, gameObject.tag);
                    arsenal.Fire (shotSpawnRight[i], fireType, gameObject.tag);
                }
            }

            if (energy < Constants.ENERGYMAX && Time.time > nextRegen) {
                nextRegen = Time.time + regenRate;
                amountEnergy = 2.5f;
                energy = energy + 2.5f;
            }

            if (energy > Constants.ENERGYMAX) {
                energy = Constants.ENERGYMAX;
            } else if (energy < 0) {
                energy = 0;
            }

            uiController.UpdateEnergy(energy-((nextRegen - Time.time)/regenRate*amountEnergy));
            if (bomb > 0 && Input.GetKey(dataController.GetKeyInput(Constants.KEYBOMB)) && Time.time > nextBombFire) {
                --bomb;
                nextBombFire = Time.time + fireBombRate;
                arsenal.Fire (transform, Constants.BOMB, gameObject.tag);
                playerController.UpdatePlayerInfoUI();
            }

            if (Input.GetKeyDown(dataController.GetKeyInput(Constants.KEYSWITCH))) {
                isFocus = !isFocus;
            }
        }
    }
    void Update()
    {
        if (Time.timeScale == 1)
        {
            int i = fireLevel;
            i = (i > numberOfSpawn) ? numberOfSpawn : i;

            if (Input.GetKey(dataController.GetKeyInput(Constants.KEYMAINATTACK)))
            {
                if (!isFocus && Time.time > nextFire)
                {
                    nextFire = Time.time + fireRate;

                    arsenal.Fire(mainShotSpawn, fireType, gameObject.tag);

                    for (; i >= 0; --i)
                    {
                        shotSpawnLeft[i].rotation  = Quaternion.Euler(0.0f, 0.0f, 0.0f);
                        shotSpawnRight[i].rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f);

                        arsenal.Fire(shotSpawnLeft[i], fireType, gameObject.tag);
                        arsenal.Fire(shotSpawnRight[i], fireType, gameObject.tag);
                    }
                }
                else if (isFocus && energy - 4 > 0 && Time.time > nextRegen)
                {
                    amountEnergy = -10f;
                    energy       = energy - 10;

                    nextRegen = Time.time + regenRate;
                    if (specialShot == null)
                    {
                        specialShot = arsenal.SpecialFire(gameObject, fireSpecialType);
                        swScript    = specialShot.GetComponent <SpecialWeapon> ();
                    }
                    swScript.FillUp();
                }
            }
            else if (Input.GetKey(dataController.GetKeyInput(Constants.KEYALTATTACK)) && Time.time > nextFire)
            {
                nextFire = Time.time + fireRate;

                int magnitudeX = (isFocus) ? 0 : 5;

                arsenal.Fire(mainShotSpawn, fireType, gameObject.tag);

                for (; i >= 0; --i)
                {
                    shotSpawnLeft[i].LookAt(new Vector3(transform.position.x + (-1 * magnitudeX * (i + 1)), 0, zPosition));
                    shotSpawnRight[i].LookAt(new Vector3(transform.position.x + (magnitudeX * (i + 1)), 0, zPosition));

                    arsenal.Fire(shotSpawnLeft[i], fireType, gameObject.tag);
                    arsenal.Fire(shotSpawnRight[i], fireType, gameObject.tag);
                }
            }

            if (energy < Constants.ENERGYMAX && Time.time > nextRegen)
            {
                nextRegen    = Time.time + regenRate;
                amountEnergy = 2.5f;
                energy       = energy + 2.5f;
            }

            if (energy > Constants.ENERGYMAX)
            {
                energy = Constants.ENERGYMAX;
            }
            else if (energy < 0)
            {
                energy = 0;
            }

            uiController.UpdateEnergy(energy - ((nextRegen - Time.time) / regenRate * amountEnergy));
            if (bomb > 0 && Input.GetKey(dataController.GetKeyInput(Constants.KEYBOMB)) && Time.time > nextBombFire)
            {
                --bomb;
                nextBombFire = Time.time + fireBombRate;
                arsenal.Fire(transform, Constants.BOMB, gameObject.tag);
                playerController.UpdatePlayerInfoUI();
            }

            if (Input.GetKeyDown(dataController.GetKeyInput(Constants.KEYSWITCH)))
            {
                isFocus = !isFocus;
            }
        }
    }