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

        if (hp.GetValue() <= 0)
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        private void OnHeightChanged()
        {
            Vector3 pos          = gameObject.transform.position;
            float   playerHeight = PlayerHeight.GetValue();

            if (playerHeight > pos.y)
            {
                pos.y = PlayerHeight.GetValue();
                gameObject.transform.position = pos;
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 6
0
        private void Compute()
        {
            float height       = MaxHeightReached.GetValue();
            int   currentLevel = Mathf.CeilToInt(MAX_DIFFICULTY * height / (EQUILIBRIUM + height));

            Difficulty.SetValue(currentLevel);
        }
Exemplo n.º 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
    }
Exemplo n.º 8
0
        private void Update()
        {
            Vector3 pos = gameObject.transform.position;

            pos.y += RisePerSecond.GetValue() * Time.deltaTime;

            gameObject.transform.position = pos;
        }
Exemplo n.º 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);
        }
Exemplo n.º 10
0
        private void Update()
        {
            Height = transform.position.y;

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

            int score = height + numSparks;

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

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

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