Example #1
0
    /**********************************************************************************/
    // GetWeaponIcons - возвращает набор иконок зарядок оружия по указанному ID
    //
    /**********************************************************************************/
    public WeaponImageSet GetWeaponIcons(WEAPON weaponId)
    {
        switch (weaponId)
        {
        case WEAPON.BLUSTER:
            return(BlusterIcoSpriteSet);

        case WEAPON.ACID_GUN:
            return(AcidGunSpriteSet);

        case WEAPON.SHOTGUN:
            return(ShotGunIcoSpriteSet);

        case WEAPON.MOCUS:
            return(MocusIcoSpriteSet);

        case WEAPON.TENTAKLES:
            return(TentaclesIcoSpriteSet);

        case WEAPON.PLASMA_GRENADE:
            return(PlasmaGrenadeIcoSpriteSet);

        case WEAPON.RGD_GRENADE:
            return(RGDGrenadeIcoSpriteSet);

        case WEAPON.TUREL_BUILDER:
            return(TurelBuilderSpriteSet);

        default:
            Debug.LogError("We have no ico set for this weapon: " + weaponId.ToString());
            return(null);
        }
    }
Example #2
0
    /**********************************************************************************************/
    // устанавливаем конкретное оружие в конкретный слот
    //
    /**********************************************************************************************/
    public void SetWeaponInSlot(PlayerController.WEAPON_SLOT slot, WEAPON weaponType)
    {
        if ((int)slot >= m_weaponImgCtrArr.Count)
        {
            Debug.LogError("ERROR! wrong weaponId: " + slot);
            return;
        }

        WeaponImageSet iconsSet = WeaponLibrary.GetInstance().GetWeaponIcons(weaponType);

        Debug.Log("SetWeaponInSlot");
        if (iconsSet.sprite100 == null)
        {
            Debug.LogError("iconsSet is empty!");
        }

        m_weaponImgCtrArr[(int)slot].SpriteSet = iconsSet;

        // настраиваем цветовую схему
        Color colorForUse = Color.white;

        if (iconsSet.UseColoring)
        {
            colorForUse = ColorChecme;
        }

        m_weaponImgCtrArr[(int)slot].SetColorScheme(colorForUse);
    }
Example #3
0
    /// -------------------------------------------
    ///
    ///     Pickups
    ///
    /// -------------------------------------------

    public void OnItemPickup(Pickup.PickupType pickupType)
    {
        switch (pickupType)
        {
        // Spread fire
        case Pickup.PickupType.Spread:
            _weapon          = WEAPON.SPREAD;
            _HasPickupSpread = true;
            break;

        // Rapid fire
        case Pickup.PickupType.RapidFire:
            _currentFireDelay  *= _reduceFiringDelay;
            _HasPickupRapidFire = true;
            break;

        // Speed boost
        case Pickup.PickupType.SpeedBoost:
            _currentSpeedBonus  += _speedBonus;
            _HasPickupSpeedboost = true;
            break;

        // Health pack
        case Pickup.PickupType.Healthpack:
            _currentHealth += _addHealthAmount;
            break;

        default: break;
        }
    }
Example #4
0
 private void DoActionNormal()
 {
     // INPUT JUMP
     if (ControllerInput.manager.jump && RPGCharacterController.instance.canJump)
     {
         SetModeJump();
     }
     // INPUT MELEE
     if (ControllerInput.manager.melee && RPGCharacterController.instance.canAction)
     {
         if (RPGCharacterController.instance.currentKind != ALIGN.demonic)
         {
             RPGCharacterController.instance.Sword();
             m_currentWeapon = WEAPON.SWORDS;
         }
         RPGCharacterController.instance.Attack(ComboManager.manager.Combo("X"));
     }
     // INPUT BOW
     if (ControllerInput.manager.bow && RPGCharacterController.instance.canAction)
     {
         if (RPGCharacterController.instance.currentKind != ALIGN.angelic)
         {
             RPGCharacterController.instance.Bow();
             m_currentWeapon = WEAPON.BOW;
         }
         RPGCharacterController.instance.Attack(ComboManager.manager.Combo("B"));
     }
     // INPUT DASH
     if (ControllerInput.manager.dash)
     {
         SetModeDash();
     }
 }
Example #5
0
    /**********************************************************************************************/
    // функция устанавливает конкретноое оружие в конкретный слот
    //
    /**********************************************************************************************/
    public void SetWeaponInSlot(int playerId, PlayerController.WEAPON_SLOT slot, WEAPON weaponType)
    {
        GameObject            weaponPanel = getWeaponPanelById(playerId);
        WeaponPanelController ctr         = weaponPanel.GetComponent <WeaponPanelController>();

        ctr.SetWeaponInSlot(slot, weaponType);
    }
Example #6
0
 // Use this for initialization
 void Awake()
 {
     weapon      = WEAPON.NORMAL;
     state       = STATE.CREATE;
     death_Count = 0;
     nowTIme     = 0;
     isNotShield = 1.0f;
     Init();
 }
    // Use this for initialization
    void Start()
    {
        //Set Weapon to Generic States
        weaponState           = WEAPON.BLANK;
        currentDamageModifier = baseDamageModifier;

        readyWeapons();
        currentSecondaryAmmo = maxSecondaryAmmo;
    }
    void OnEnable()
    {
        weapon = GameObject.Find("Player").GetComponent <Player>().weapon;

        switch (weapon)
        {
        case WEAPON.ROUNDBALL:
            this.gameObject.transform.Find("RoundBall").gameObject.SetActive(true);
            break;
        }
    }
Example #9
0
 void CheckWeapons()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         currentWeapon = WEAPON.BOW;
     }
     if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         currentWeapon = WEAPON.ROCKET_LAUNCHER;
     }
 }
    /**********************************************************************************/
    // функция зарядки оружия
    //
    /**********************************************************************************/
    void ChargeWeapon(WEAPON_SLOT slot, WEAPON weaponID, int ammo)
    {
        List <WEAPON>           weaponIds  = null;
        List <ClassicWeaponCtr> weaponCtrs = null;

        switch (slot)
        {
        case WEAPON_SLOT.MAIN:
            weaponIds  = m_mainWeaponIds;
            weaponCtrs = m_mainWeaponCollection;
            break;

        case WEAPON_SLOT.CAPTURE:
            weaponIds  = m_captureWeaponIds;
            weaponCtrs = m_captureWeaponCollection;
            break;

        case WEAPON_SLOT.EXLOSION:
            weaponIds  = m_explosionWeaponIds;
            weaponCtrs = m_explosionWeaponCollection;
            break;

        case WEAPON_SLOT.SPECIAL:
            weaponIds  = m_specialWeaponIds;
            weaponCtrs = m_specialWeaponCollection;
            break;
        }

        // пробуем найти нужное оружие и устанавливаем его индекс
        int  index   = 0;
        bool wasFind = false;

        for (; index < weaponIds.Count; index++)
        {
            WEAPON id = weaponIds[index];
            if (id == weaponID)
            {
                wasFind = true;
                break;
            }
        }

        if (!wasFind)
        {
            Debug.LogError("We cant charge weapon: " + weaponID + " in slot: " + slot);
            return;
        }

        // заряжаем оружие и обновляем UI
        ClassicWeaponCtr wCtr = weaponCtrs[index];

        wCtr.ChargeAmmo(ammo);
        UpdateWeaponSlot(slot);
    }
Example #11
0
    void Update()
    {
        if (RoomManager.Instance.Pause)
        {
            return;
        }

        // Inventory and map screen interaction
        // this should be in another class but I'm to lazy...
        if (Input.GetKeyUp(KeyCode.S))
        {
            playClick();
            if (inventoryMode)
            {
                RoomManager.Instance.Inventory.SetActive(false);
                inventoryMode = false;
            }
            else
            {
                RoomManager.Instance.Inventory.SetActive(true);
                inventoryMode = true;
            }
        }
        if (inventoryMode)
        {
            if (Input.GetKeyUp(KeyCode.RightArrow))
            {
                playClick();
                weapon++;
                if (weapon == WEAPON.LASTWEAPON)
                {
                    weapon = 0;
                }
            }
            else
            if (Input.GetKeyUp(KeyCode.LeftArrow))
            {
                weapon--;
                playClick();
                if (weapon < 0)
                {
                    weapon = WEAPON.LASTWEAPON - 1;
                }
            }
            GameObject selector      = GameObject.Find("selector");
            GameObject selectorStart = GameObject.Find("selectorstart");
            selector.transform.position = selectorStart.transform.position + new Vector3((float)weapon, 0, -4);           //new Vector3(-1.394853f+(float)weapon,-0.3478584f,-4);
        }
        else
        {
            checkAction();
        }
    }
Example #12
0
 /// <summary>
 /// Handle all the cases where we switch weapons
 /// </summary>
 private void HandleWeaponSwitching()
 {
     // If 1, switch to raycast pistol
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         currentWeapon = WEAPON.RAYCAST_PISTOL;
     }
     // If 2, switch to spread shot
     else if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         currentWeapon = WEAPON.SPREAD_SHOT;
     }
 }
Example #13
0
 void Start()
 {
     currentWeapon = WEAPON.noWeapon;                      // Set to not have weapon at the beginning
     weaponAmount  = Enum.GetNames(typeof(WEAPON)).Length; // Initialize the amount of weapons
     input         = gameObject.GetComponent <KartInput>();
 }
Example #14
0
        private void AirControl()
        {
            Vector3 motion = RPGCharacterController.instance.inputVec;

            motion *= (Mathf.Abs(RPGCharacterController.instance.inputVec.x) == 1 && Mathf.Abs(RPGCharacterController.instance.inputVec.z) == 1) ? 0.7f : 1;
            RPGCharacterController.instance.rb.AddForce(motion * RPGCharacterController.instance.inAirSpeed, ForceMode.Acceleration);
            //limit the amount of velocity we can achieve
            float velocityX = 0;
            float velocityZ = 0;

            if (RPGCharacterController.instance.rb.velocity.x > RPGCharacterController.instance.maxVelocity)
            {
                velocityX = GetComponent <Rigidbody>().velocity.x - RPGCharacterController.instance.maxVelocity;
                if (velocityX < 0)
                {
                    velocityX = 0;
                }
                RPGCharacterController.instance.rb.AddForce(new Vector3(-velocityX, 0, 0), ForceMode.Acceleration);
            }
            if (RPGCharacterController.instance.rb.velocity.x < RPGCharacterController.instance.minVelocity)
            {
                velocityX = RPGCharacterController.instance.rb.velocity.x - RPGCharacterController.instance.minVelocity;
                if (velocityX > 0)
                {
                    velocityX = 0;
                }
                RPGCharacterController.instance.rb.AddForce(new Vector3(-velocityX, 0, 0), ForceMode.Acceleration);
            }
            if (RPGCharacterController.instance.rb.velocity.z > RPGCharacterController.instance.maxVelocity)
            {
                velocityZ = RPGCharacterController.instance.rb.velocity.z - RPGCharacterController.instance.maxVelocity;
                if (velocityZ < 0)
                {
                    velocityZ = 0;
                }
                RPGCharacterController.instance.rb.AddForce(new Vector3(0, 0, -velocityZ), ForceMode.Acceleration);
            }
            if (RPGCharacterController.instance.rb.velocity.z < RPGCharacterController.instance.minVelocity)
            {
                velocityZ = RPGCharacterController.instance.rb.velocity.z - RPGCharacterController.instance.minVelocity;
                if (velocityZ > 0)
                {
                    velocityZ = 0;
                }
                RPGCharacterController.instance.rb.AddForce(new Vector3(0, 0, -velocityZ), ForceMode.Acceleration);
            }
            // INPUT MELEE
            if (ControllerInput.manager.melee)
            {
                if (RPGCharacterController.instance.currentKind != ALIGN.demonic)
                {
                    RPGCharacterController.instance.Sword();
                    m_currentWeapon = WEAPON.SWORDS;
                }
                RPGCharacterController.instance.JumpAttack(ComboManager.manager.Combo("X"));
            }
            // INPUT BOW
            if (ControllerInput.manager.bow)
            {
                if (RPGCharacterController.instance.currentKind != ALIGN.angelic)
                {
                    RPGCharacterController.instance.Bow();
                    m_currentWeapon = WEAPON.BOW;
                }
                RPGCharacterController.instance.JumpAttack(ComboManager.manager.Combo("B"));
            }
        }
Example #15
0
 // Pick up a random weapon for player
 public void pickUpRandomWeapon()
 {
     currentWeapon = ((WEAPON)UnityEngine.Random.Range(0, weaponAmount-1));
     Debug.Log(currentWeapon + " is current weapon");
 }
Example #16
0
    //----------------------------------------------------------------------------------
    // *** FUNCTIONS ***

    /// -------------------------------------------
    ///
    ///     Startup
    ///
    /// -------------------------------------------

    protected override void Start()
    {
        _team = TEAM.PLAYER;

        Camera mainCamera = Camera.main;

        _playAreaMax = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, transform.position.y - mainCamera.transform.position.y));
        _playAreaMin = Camera.main.ScreenToWorldPoint(new Vector3(mainCamera.pixelWidth, mainCamera.pixelHeight, transform.position.y - mainCamera.transform.position.y));

        //Move to bottom of screen
        float zOffset = (_playAreaMax.z - _playAreaMin.z) * -_zOffset;

        _playAreaMin.x *= _xPlayRatio;
        _playAreaMin.z *= _zPlayRatio;
        _playAreaMin.z += zOffset;

        _playAreaMax.x *= _xPlayRatio;
        _playAreaMax.z *= _zPlayRatio;
        _playAreaMax.z += zOffset;

        _rb = GetComponent <Rigidbody>();

        //-------------------------------
        /* Update active pickup timers */
        //-------------------------------

        // Speed boost
        if (_HasPickupSpeedboost)
        {
            _PickupTimerSpeedboost += Time.deltaTime;

            // Speed boost pickup has reached duration threshold
            if (_PickupTimerSpeedboost >= _PickupDuration)
            {
                _HasPickupSpeedboost = false;
            }
        }

        // Speed boost has ended / not active
        else
        {
            _currentSpeedBonus = 0;
        }

        // Rapid fire timer
        if (_HasPickupRapidFire)
        {
            _PickupTimerRapidFire += Time.deltaTime;

            // Speed boost pickup has reached duration threshold
            if (_PickupTimerRapidFire >= _PickupDuration)
            {
                _HasPickupRapidFire = false;
            }
        }

        // Rapid fire has ended / not active
        else
        {
            _currentFireDelay = _baseFireDelay;
        }

        // Spread fire timer
        if (_HasPickupSpread)
        {
            _PickupTimerSpread += Time.deltaTime;

            // Speed boost pickup has reached duration threshold
            if (_PickupTimerSpread >= _PickupDuration)
            {
                _HasPickupSpread = false;
            }
        }

        // Spread fire has ended / not active
        else
        {
            _weapon = WEAPON.BASIC;
        }
    }
Example #17
0
 internal Weapon(WEAPON data)
 {
     _data = data;
 }
Example #18
0
 internal static HandleRef getCPtr(WEAPON obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Example #19
0
    /**********************************************************************************/
    // GetWeaponById - возвращает копию контроллера по указанному ID
    //
    /**********************************************************************************/
    public ClassicWeaponCtr GetWeaponById(WEAPON weaponId, PLAYER ownerID)
    {
        ClassicWeaponCtr ctr = null;

        if (weaponId == WEAPON.TENTAKLES && ownerID == PLAYER.PL1)
        {
            RegeneratedWeaponCtr tentakles = new RegeneratedWeaponCtr((int)ownerID);
            tentakles.BulletType           = TentaclesWeapon_Pl1.BulletType;
            tentakles.FireRechargeTime     = TentaclesWeapon_Pl1.FireRechargeTime;
            tentakles.MagazineAmmo         = TentaclesWeapon_Pl1.MagazineAmmo;
            tentakles.NumberOfBullet       = TentaclesWeapon_Pl1.NumberOfBullet;
            tentakles.TimeToRegenerateAmmo = TentaclesWeapon_Pl1.TimeToRegenerateAmmo;
            ctr = tentakles;
        }
        else if (weaponId == WEAPON.TENTAKLES && ownerID == PLAYER.PL2)
        {
            RegeneratedWeaponCtr tentakles = new RegeneratedWeaponCtr((int)ownerID);
            tentakles.BulletType           = TentaclesWeapon_Pl2.BulletType;
            tentakles.FireRechargeTime     = TentaclesWeapon_Pl2.FireRechargeTime;
            tentakles.MagazineAmmo         = TentaclesWeapon_Pl2.MagazineAmmo;
            tentakles.NumberOfBullet       = TentaclesWeapon_Pl2.NumberOfBullet;
            tentakles.TimeToRegenerateAmmo = TentaclesWeapon_Pl2.TimeToRegenerateAmmo;
            ctr = tentakles;
        }
        else if (weaponId == WEAPON.BLUSTER)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = BlusterWeapon.BulletType;
            wCtr.FireRechargeTime = BlusterWeapon.FireRechargeTime;
            wCtr.MagazineAmmo     = BlusterWeapon.MagazineAmmo;
            wCtr.NumberOfBullet   = BlusterWeapon.NumberOfBullet;
            ctr = wCtr;
        }
        else if (weaponId == WEAPON.ACID_GUN)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = AcidGun.BulletType;
            wCtr.FireRechargeTime = AcidGun.FireRechargeTime;
            wCtr.MagazineAmmo     = AcidGun.MagazineAmmo;
            wCtr.NumberOfBullet   = AcidGun.NumberOfBullet;
            ctr = wCtr;
        }
        else if (weaponId == WEAPON.SHOTGUN)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = ShotGun.BulletType;
            wCtr.FireRechargeTime = ShotGun.FireRechargeTime;
            wCtr.MagazineAmmo     = ShotGun.MagazineAmmo;
            wCtr.NumberOfBullet   = ShotGun.NumberOfBullet;
            ctr = wCtr;
        }
        else if (weaponId == WEAPON.MOCUS && ownerID == PLAYER.PL1)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = MocusGun_Pl1.BulletType;
            wCtr.FireRechargeTime = MocusGun_Pl1.FireRechargeTime;
            wCtr.MagazineAmmo     = MocusGun_Pl1.MagazineAmmo;
            wCtr.NumberOfBullet   = MocusGun_Pl1.NumberOfBullet;
            ctr = wCtr;
        }
        else if (weaponId == WEAPON.MOCUS && ownerID == PLAYER.PL2)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = MocusGun_Pl2.BulletType;
            wCtr.FireRechargeTime = MocusGun_Pl2.FireRechargeTime;
            wCtr.MagazineAmmo     = MocusGun_Pl2.MagazineAmmo;
            wCtr.NumberOfBullet   = MocusGun_Pl2.NumberOfBullet;
            ctr = wCtr;
        }
        else if (weaponId == WEAPON.PLASMA_GRENADE)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = PlasmaGrenade.BulletType;
            wCtr.FireRechargeTime = PlasmaGrenade.FireRechargeTime;
            wCtr.MagazineAmmo     = PlasmaGrenade.MagazineAmmo;
            wCtr.NumberOfBullet   = PlasmaGrenade.NumberOfBullet;
            ctr = wCtr;
        }
        else if (weaponId == WEAPON.RGD_GRENADE)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = RGDGrenade.BulletType;
            wCtr.FireRechargeTime = RGDGrenade.FireRechargeTime;
            wCtr.MagazineAmmo     = RGDGrenade.MagazineAmmo;
            wCtr.NumberOfBullet   = RGDGrenade.NumberOfBullet;
            ctr = wCtr;
        }
        else if (weaponId == WEAPON.TUREL_BUILDER && ownerID == PLAYER.PL1)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = TurelBuilder_Pl1.BulletType;
            wCtr.FireRechargeTime = TurelBuilder_Pl1.FireRechargeTime;
            wCtr.MagazineAmmo     = TurelBuilder_Pl1.MagazineAmmo;
            wCtr.NumberOfBullet   = TurelBuilder_Pl1.NumberOfBullet;
            ctr = wCtr;
        }
        else if (weaponId == WEAPON.TUREL_BUILDER && ownerID == PLAYER.PL2)
        {
            ClassicWeaponCtr wCtr = new ClassicWeaponCtr((int)ownerID);
            wCtr.BulletType       = TurelBuilder_Pl2.BulletType;
            wCtr.FireRechargeTime = TurelBuilder_Pl2.FireRechargeTime;
            wCtr.MagazineAmmo     = TurelBuilder_Pl2.MagazineAmmo;
            wCtr.NumberOfBullet   = TurelBuilder_Pl2.NumberOfBullet;
            ctr = wCtr;
        }

        return(ctr);
    }
Example #20
0
 void CmdDebugChangeWeapon(int index)
  {
      currentWeapon = (WEAPON)index;
  }
Example #21
0
 public static void InfiniteAmmo(bool toggle)
 {
     WEAPON.SET_PED_INFINITE_AMMO_CLIP(PLAYER.PLAYER_PED_ID(), toggle);
 }
Example #22
0
 // Use this for initialization
 void Start()
 {
     weapon = GameObject.Find("Player").GetComponent <Player>().weapon;
     shield.GetComponent <CircleCollider2D>().enabled = false;
     shield.transform.Find("shield").gameObject.SetActive(false);
 }
Example #23
0
 void SwitchWeapon(WEAPON _weapon)
 {
     audio.PlayOneShot(switch_weapon_sound, 1.0f);
     current_weapon = (uint)_weapon;
 }
 public void setState(WEAPON nState)
 {
     weaponState = nState;
 }
Example #25
0
 void CmdDebugChangeWeapon(int index)
 {
     currentWeapon = (WEAPON)index;
 }
Example #26
0
 // Pick up a random weapon for player
 public void pickUpRandomWeapon()
 {
     currentWeapon = ((WEAPON)UnityEngine.Random.Range(0, weaponAmount - 1));
     Debug.Log(currentWeapon + " is current weapon");
 }
Example #27
0
 public static int GetSelectedWeapon()
 {
     return(WEAPON.GET_SELECTED_PED_WEAPON(PLAYER.PLAYER_PED_ID()));
 }
Example #28
0
 public void OnChangeWeapon()
 {
     currWeapon         = (WEAPON)((int)++currWeapon % 2);
     weaponImage.sprite = weaponIcons[(int)currWeapon];
 }
Example #29
0
 public static void GiveWeapon(Weapons weapon)
 {
     WEAPON.GIVE_WEAPON_TO_PED(PLAYER.PLAYER_PED_ID(), (int)weapon, 500, false, true);
 }
Example #30
0
 void Start()
 {
     currentWeapon = WEAPON.noWeapon; // Set to not have weapon at the beginning
     weaponAmount = Enum.GetNames(typeof(WEAPON)).Length; // Initialize the amount of weapons
     input = gameObject.GetComponent<KartInput>();
 }