Exemplo n.º 1
0
    public void ChangeGrenadeAmmo()
    {
        SlotInfo sInfo = gc.slotsController.habilitySlots[grenadesSlotNum].GetComponent <SlotInfo>();

        sInfo.Consume();
        grenadeAmmo--;
    }
Exemplo n.º 2
0
    public void HabilityEffect(SlotInfo sInfo, int num)
    {
        switch (sInfo.content)
        {
        case "Jetpack":
            verticalSpeed = playerModel.jetpackVerticalSpeed;
            sInfo.Consume();
            break;

        case "Grenade":
            if (!lineRenderer.gameObject.activeSelf)
            {
                grenadesSlotNum = num;
                grenadeAmmo     = sInfo.charges;
                if (actualWeapon != Weapon.launcher)
                {
                    actualWeapon = Weapon.launcher;
                }
                if (withDefense)
                {
                    DestroyDefense();
                    gun.SetActive(true);
                }
                ChangeState(new PSGrenadeLauncher(this));
            }
            break;

        case "Laser":
            if (!withDefense && !lineRenderer.gameObject.activeSelf)
            {
                previousState = currentState;
                sInfo.Consume();
                ChangeState(new PSLaser(this));
            }
            break;
        }
    }
Exemplo n.º 3
0
    public void PlaceDeffense()
    {
        RaycastHit hit;

        if (Physics.Raycast(pointAttachDefense.position, -Vector3.up, out hit, playerModel.distancePlaceDefense, placeDefenseMask))
        {
            switch (defense)
            {
            case "Mine":
                GameObject mine = Instantiate(minePrefab, hit.point, attachedDefense.transform.rotation);
                mine.GetComponent <SphereCollider>().enabled = true;
                break;
            }
            DestroyDefense();
            gun.SetActive(true);
            SlotInfo sInfo = gc.slotsController.defenseSlots[defenseSlotNum].GetComponent <SlotInfo>();
            sInfo.Consume();
            ChangeState(previousState);
        }
    }