public bool HoldPill(Pill.Effect effect) { if (PickupCooldown == 0) { PickupCooldown = 10; if (isHoldingPill()) { Vector3 temppos = gameObject.transform.position; temppos.y += 2; Pill newPill = (Instantiate(PillPrefab, temppos, Quaternion.identity) as GameObject).GetComponent <Pill>(); newPill.PillEffect = PillEffect; } PillEffect = effect; levelMenu.SetHUDPill(effect); return(true); } else { return(false); } }
public void UsePill() { if (levelMenu != null) { levelMenu.SetHUDPill(Pill.Effect.Nothing); } UsageCooldown = 20; switch (PillEffect) { case Pill.Effect.Nothing: break; case Pill.Effect.DamageUp: GameObject.Find("Rollator").GetComponent <PunchDamage>().Damage += 2; break; case Pill.Effect.SpeedDown: gameObject.GetComponent <PlayerController>().SetPillSpeed(15); break; case Pill.Effect.SpeedUp: gameObject.GetComponent <PlayerController>().SetPillSpeed(45); break; } PillEffect = Pill.Effect.Nothing; }
public bool HoldPill(Pill.Effect effect) { if (PickupCooldown == 0) { PickupCooldown = 10; if (isHoldingPill()) { Vector3 temppos = gameObject.transform.position; temppos.y += 2; Pill newPill = (Instantiate(PillPrefab, temppos, Quaternion.identity) as GameObject).GetComponent<Pill>(); newPill.PillEffect = PillEffect; } PillEffect = effect; levelMenu.SetHUDPill(effect); return true; } else { return false; } }
public void SetHUDPill(Pill.Effect effect) { if (effect != Pill.Effect.Nothing) { currentPill.material = Pill.getMaterial(effect); currentPill.color = Color.white; } else { currentPill.material = defaultPillMaterial; currentPill.color = defaultPillColor; } }
public void UsePill() { if (levelMenu != null) { levelMenu.SetHUDPill(Pill.Effect.Nothing); } UsageCooldown = 20; switch (PillEffect) { case Pill.Effect.Nothing: break; case Pill.Effect.DamageUp: GameObject.Find("Rollator").GetComponent<PunchDamage>().Damage += 2; break; case Pill.Effect.SpeedDown: gameObject.GetComponent<PlayerController>().SetPillSpeed(15); break; case Pill.Effect.SpeedUp: gameObject.GetComponent<PlayerController>().SetPillSpeed(45); break; } PillEffect = Pill.Effect.Nothing; }