Ejemplo n.º 1
0
    void OnMouseOver()
    {
        //click object multiple times to turn on or off.
        //if mouse is being clicked else where, then noting should happen.
        float distanceToTarget = Vector3.Distance(transform.position, target.position);

//       print(distanceToTarget);
        if (dontCare == false)
        {
            if (timer > 1.2f)
            {
                if (Input.GetMouseButton(0))
                {
                    if (distanceToTarget < 2)
                    {
                        int damage = rand.Next(3, 5);
                        counters.SetActive(true);
                        //  if (audioThing.clip != battle) {
                        //     audioThing.clip = battle;
                        //     audioThing.Play ();
                        //  }
                        //  CutsceneTutorial.musicTimer = 0;
                        CutsceneTutorial.timerCounter = 0;
                        counter++;
                        counterText.text = counter + "";
                        health          -= damage;
                        string damageSTR = damage + "";
                        print(damageSTR);
                        timer = 1f;
                        PopupTextController.CreateFloatingText(damageSTR, transform, orb);
                        //    Vector3 moveDirection = target.position - transform.position;
                        //    if (!isWarrior) {
                        //       rb.AddForce (moveDirection.normalized * -700f);
                        //    }
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0

        
Ejemplo n.º 3
0
 public void Damage(float damage)
 {
     PopupTextController.CreateFloatingText(damage.ToString(), transform);
     Debug.Log(gameObject.name + " received " + damage + " damage.");
     health -= damage;
 }