コード例 #1
0
ファイル: AiOrb.cs プロジェクト: Nephrot/Video-Game-Design
    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);
                        //    }
                    }
                }
            }
        }
    }
コード例 #2
0

        
コード例 #3
0
ファイル: EnemyClass.cs プロジェクト: mdh3rman/Lazy-RPG
 public void Damage(float damage)
 {
     PopupTextController.CreateFloatingText(damage.ToString(), transform);
     Debug.Log(gameObject.name + " received " + damage + " damage.");
     health -= damage;
 }