public void ChangeGrenadeAmmo() { SlotInfo sInfo = gc.slotsController.habilitySlots[grenadesSlotNum].GetComponent <SlotInfo>(); sInfo.Consume(); grenadeAmmo--; }
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; } }
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); } }