public void CheckDamage() { Debug.Log("Player checks HP for death. HP is: " + hp.GetValue()); if (hp.GetValue() <= 0) { Destroy(gameObject); } }
public void CollectSpark() { float amount = Charge + 1.0f; Charge = Mathf.Clamp(amount, 0, MaxCharge.GetValue()); int sparksCollected = SparksCollected.GetValue() + 1; SparksCollected.SetValue(sparksCollected); }
private void OnHeightChanged() { Vector3 pos = gameObject.transform.position; float playerHeight = PlayerHeight.GetValue(); if (playerHeight > pos.y) { pos.y = PlayerHeight.GetValue(); gameObject.transform.position = pos; } }
private void Awake() { m_Body = gameObject.GetComponent <Rigidbody2D>(); Assert.IsNotNull(m_Body, "Rigidbody2D is not found on player gameobject!"); Charge = DefaultCharge.GetValue(); Lives = DefaultLives.GetValue(); MaxHeight = 0; Dead.SetValue(false); }
private void OnEnable() { Vector3 pos = gameObject.transform.position; if (pos.y < PlayerHeight.GetValue()) { pos.y = PlayerHeight.GetValue(); } gameObject.transform.position = pos; enabled = false; }
private void Compute() { float height = MaxHeightReached.GetValue(); int currentLevel = Mathf.CeilToInt(MAX_DIFFICULTY * height / (EQUILIBRIUM + height)); Difficulty.SetValue(currentLevel); }
void FixedUpdate() { float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical"); Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical); rb.AddForce(movement * moveSpeed.GetValue()); // FloatReference }
private void Update() { Vector3 pos = gameObject.transform.position; pos.y += RisePerSecond.GetValue() * Time.deltaTime; gameObject.transform.position = pos; }
public override void Execute(MonoBehaviour _behaviour) { Assert.IsNotNull(Text, "Please set a Text component"); float value = Value.GetValue(); Text.text = string.Format(Format.GetValue(), value); }
private void Update() { Height = transform.position.y; if (m_IsRecharging && Charge < DefaultCharge.GetValue()) { Charge += RechargeSpeed.GetValue() * Time.deltaTime; } }
private void ComputeScore() { int height = Mathf.CeilToInt(MaxHeight.GetValue()); int numSparks = SparksCollected.GetValue(); int score = height + numSparks; Score.SetValue(score); }
public override void Execute(MonoBehaviour _behaviour) { Assert.IsNotNull(Image, "Please set an image"); float fraction = Amount.GetValue() / Full.GetValue(); fraction = Mathf.Clamp(fraction, 0, 1); Image.fillAmount = fraction; }
private void OnHeightChanged() { Vector3 pos = gameObject.transform.position; pos.y = PlayerHeight.GetValue(); if (pos.y < 0) { pos.y = 0; } gameObject.transform.position = pos; }
void Start() { rb = GetComponent <Rigidbody>(); hp.SetValue(hpMax.GetValue()); // Reset hp }
IEnumerator DelayAction(MonoBehaviour _behaviour) { yield return(new WaitForSeconds(DelayInSeconds.GetValue())); Actions.GetValue().Execute(_behaviour); }
public override void Execute(MonoBehaviour _behaviour) { Assert.IsNotNull(Variable, "Please set a Variable!"); Variable.SetValue(Value.GetValue()); }