Esempio n. 1
0
    /**********************************************************************************/
    // функция стрельбы
    //
    /**********************************************************************************/
    protected virtual void FireWeapon(Vector2 position, Base.DIREC direction)
    {
        GameObject bulletObj = ObjectFactory.GetInstance().CreateGObject(position, direction, BulletType);
        Bullet     bulletCtr = bulletObj.GetComponent <Bullet>();

        if (bulletCtr != null)
        {
            bulletCtr.Owner       = m_ownerID;
            bulletCtr.OwnerUnitID = m_unitID;
        }
        else
        {
            // некоторые типы оружия используют других существ в качестве снаряда
            // в этом случае используем GMovingObject
            CIGameObject gmo = bulletObj.GetComponent <CIGameObject>();
            gmo.Owner = m_ownerID;
        }


        m_currentNumOfFiredBullets++;
        if (m_currentNumOfFiredBullets >= NumberOfBullet)
        {
            m_state = WEAPON_STATE.RECHARGE;
            m_currentRechargeTimer = FireRechargeTime;
        }
    }
Esempio n. 2
0
 //Throw in given direction
 public void Thrown(Vector3 front)
 {
     GetMass();
     cooldown           = Time.time + baseCooldown;
     currentWeaponState = WEAPON_STATE.THROWN;
     SetWeaponState();
     rb.drag = 1;
     rb.AddForce((front + new Vector3(0, 0.1f, 0)) * weaponThrowForce * totalMass);
 }
Esempio n. 3
0
 /**********************************************************************************/
 // функция перезарядки оружия
 //
 /**********************************************************************************/
 protected virtual void RechargeWeapon()
 {
     m_currentRechargeTimer -= Time.deltaTime;
     if (m_currentRechargeTimer <= 0)
     {
         m_currentRechargeTimer = 0;
         m_state = WEAPON_STATE.READY;
         m_currentNumOfFiredBullets = 0;
     }
 }
Esempio n. 4
0
 /**********************************************************************************/
 // функция включения стрельбы
 // если готовы - начинаем палить
 //
 /**********************************************************************************/
 public void Fire()
 {
     if (m_state == WEAPON_STATE.READY)
     {
         m_state = WEAPON_STATE.FIRE;
     }
     else
     {
         StopFire();
     }
 }
Esempio n. 5
0
    Light dropLight;        //Dropped lighting

    // Use this for initialization
    void Start()
    {
        rb            = GetComponent <Rigidbody>();
        dropAnimation = GetComponent <Animator>();
        dropLight     = GetComponent <Light>();
        damageDealers = GetComponentsInChildren <WeaponDamage>();

        currentWeaponState = WEAPON_STATE.DROPPED;
        SetWeaponState();
        joints = GetComponents <ConfigurableJoint>();
    }
        void OnAnimatorIK()
        {
            if (state != null && IKweaponState != state.p_Wstate)
            {
                switch (state.p_Wstate)
                {
                case WEAPON_STATE.MAIN_WEAPON:
                    Main_Weapon_Setting();
                    IKweaponState = WEAPON_STATE.MAIN_WEAPON;
                    break;

                case WEAPON_STATE.SUB_WEAPON:
                    Sub_Weapon_Setting();
                    IKweaponState = WEAPON_STATE.SUB_WEAPON;
                    break;

                case WEAPON_STATE.SPECIAL_WEAPON:
                    Third_Weapon_Setting();
                    IKweaponState = WEAPON_STATE.SPECIAL_WEAPON;
                    break;
                }
                Right_hand_setting();
            }

            else if (state != null)
            {
                if (state.p_state != STATE.DEAD && state.p_state != STATE.STUN && state.p_state != STATE.ROLL)
                {
                    // HumanBones.RightArm을 shoulder 변수로 만듬.
                    aimPivot.position = shoulder.position;
                    anim.SetLookAtWeight(1, 0.2f, 1);

                    aimPivot.LookAt(targetLook.position);
                    anim.SetLookAtPosition(targetLook.position);

                    anim.SetIKPositionWeight(AvatarIKGoal.LeftHand, lh_Weight);
                    anim.SetIKRotationWeight(AvatarIKGoal.LeftHand, lh_Weight);
                    anim.SetIKPosition(AvatarIKGoal.LeftHand, l_Hand.position);
                    anim.SetIKRotation(AvatarIKGoal.LeftHand, lh_rot);

                    anim.SetIKPositionWeight(AvatarIKGoal.RightHand, rh_Weight);
                    anim.SetIKRotationWeight(AvatarIKGoal.RightHand, rh_Weight);
                    anim.SetIKPosition(AvatarIKGoal.RightHand, r_Hand.position);
                    anim.SetIKRotation(AvatarIKGoal.RightHand, r_Hand.rotation);
                }
            }
        }
Esempio n. 7
0
        void SetSpecial()
        {
            if (playermovement != null)
            {
                switch (playermovement.p_Wstate)
                {
                case WEAPON_STATE.MAIN_WEAPON:
                    pre_state = WEAPON_STATE.MAIN_WEAPON;
                    ResetMain();
                    break;

                case WEAPON_STATE.SUB_WEAPON:
                    pre_state = WEAPON_STATE.SUB_WEAPON;
                    ResetSub();
                    break;
                }
                playermovement.p_Wstate = WEAPON_STATE.SPECIAL_WEAPON;
            }

            if (allyController != null)
            {
                switch (allyController.weaponType)
                {
                case WeaponType.MainWeapon:
                    pre_state = WEAPON_STATE.MAIN_WEAPON;
                    weaponManager.m_MainWeaponObject.SetActive(false);
                    ResetMain();
                    break;

                case WeaponType.SubWeapon:
                    pre_state = WEAPON_STATE.SUB_WEAPON;
                    weaponManager.m_SubWeaponObject.SetActive(false);
                    ResetSub();
                    break;
                }
                allyController.weaponType = WeaponType.SpecialWeapon;
            }
            // 바꿔야댐
            weaponManager.SpecialWeaponSwap(weaponManager.m_SpecialWeapon[0]);
            SettingMag();
        }
Esempio n. 8
0
 //Drop
 public void Dropped()
 {
     currentWeaponState = WEAPON_STATE.DROPPED;
     SetWeaponState();
 }
Esempio n. 9
0
 //Equip
 public void Equip()
 {
     currentWeaponState = WEAPON_STATE.WIELDED;
     SetWeaponState();
 }