Esempio n. 1
0
 public void DropWeapon()
 {
     Destroy(currentWeapon);
     weaponStats             = null;
     currentWeapon           = null;
     isHoldingWeapon         = false;
     currentWeaponAttackTime = 0.33f;
 }
Esempio n. 2
0
    public override void Enter()
    {
        base.Enter();
        weapon           = character.weaponHolster.currentWeaponSelected.GetComponent <MeeleWeapon>();
        currentTimeframe = currentStateTime = 0;
        maxStateTime     = weapon.maxTime_atk1;
        changeState      = false;

        Attack();
    }
Esempio n. 3
0
 protected override void Start()
 {
     base.Start();
     weaponItem = WeaponItem as MeeleWeapon;
     if (!weaponItem)
     {
         Destroy(gameObject);
         Debug.LogWarning("Incompatible Weapon Type!");
     }
 }
Esempio n. 4
0
    private void UpdateMeele()
    {
        MeeleWeapon m = Pawn.Item?.MeeleWeapon;

        if (m != null)
        {
            m.LightAttack = Input.GetMouseButton(0);
            m.HeavyAttack = Input.GetMouseButton(1);
        }
    }
Esempio n. 5
0
 public void GetNewWeapon(GameObject collision)
 {
     if (!isHoldingWeapon)
     {
         currentWeapon = collision;
         weaponStats   = collision.GetComponent <MeeleWeapon>();
         collision.transform.parent       = transform;
         isHoldingWeapon                  = true;
         weaponStats.isHeld               = true;
         currentWeaponAttackTime          = weaponStats.attackTime; currentWeapon.transform.position = new Vector3(0f, 0f, 0f);
         currentWeapon.transform.position = new Vector3(0f, 0f, 0f);
         if (player.localScale.x == -1f)
         {
             currentWeapon.transform.localScale = new Vector3(1f, -1f, 1f);
         }
     }
 }
Esempio n. 6
0
    private void UpdateMeele()
    {
        MeeleWeapon m = Pawn.Item?.MeeleWeapon;

        if (m == null)
        {
            return;
        }

        if (lastAttackCounter != m.AttackCounter)
        {
            chooseHeavy       = Random.value <= HeavyAttackChance;
            lastAttackCounter = m.AttackCounter;
        }

        if (TargetEnemy == null)
        {
            m.LightAttack = false;
            m.HeavyAttack = false;
        }
        else
        {
            Vector3 targetPos = TargetEnemy.transform.position;
            Vector3 botPos    = Pawn.transform.position;

            float sqrDst = (targetPos - botPos).sqrMagnitude;
            if (sqrDst <= AttackRange * AttackRange)
            {
                m.HeavyAttack = chooseHeavy;
                m.LightAttack = !chooseHeavy;
            }
            else
            {
                m.LightAttack = false;
                m.HeavyAttack = false;
            }
        }
    }