Example #1
0
    public void CheckDamage()
    {
        Debug.Log("Player checks HP for death. HP is: " + hp.GetValue());

        if (hp.GetValue() <= 0)
        {
            Destroy(gameObject);
        }
    }
Example #2
0
        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;
            }
        }
Example #4
0
        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;
        }
Example #6
0
        private void Compute()
        {
            float height       = MaxHeightReached.GetValue();
            int   currentLevel = Mathf.CeilToInt(MAX_DIFFICULTY * height / (EQUILIBRIUM + height));

            Difficulty.SetValue(currentLevel);
        }
Example #7
0
    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;
        }
Example #9
0
        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);
        }
Example #10
0
        private void Update()
        {
            Height = transform.position.y;

            if (m_IsRecharging && Charge < DefaultCharge.GetValue())
            {
                Charge += RechargeSpeed.GetValue() * Time.deltaTime;
            }
        }
Example #11
0
        private void ComputeScore()
        {
            int height    = Mathf.CeilToInt(MaxHeight.GetValue());
            int numSparks = SparksCollected.GetValue();

            int score = height + numSparks;

            Score.SetValue(score);
        }
Example #12
0
        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;
        }
Example #14
0
 void Start()
 {
     rb = GetComponent <Rigidbody>();
     hp.SetValue(hpMax.GetValue()); // Reset hp
 }
Example #15
0
        IEnumerator DelayAction(MonoBehaviour _behaviour)
        {
            yield return(new WaitForSeconds(DelayInSeconds.GetValue()));

            Actions.GetValue().Execute(_behaviour);
        }
Example #16
0
        public override void Execute(MonoBehaviour _behaviour)
        {
            Assert.IsNotNull(Variable, "Please set a Variable!");

            Variable.SetValue(Value.GetValue());
        }