コード例 #1
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         RaycastHit hit;
         if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit))
         {
             Debug.DrawLine(Camera.main.transform.position, hit.point, Color.red);
             Actable actable = hit.transform.GetComponentInChildren <Actable>();
             if (actable)
             {
                 actable.Act(new string[] { "Foo" });
             }
             Deformable deformable = hit.transform.GetComponentInChildren <Deformable>();
             if (deformable)
             {
                 deformable.Hit(hit, Camera.main.transform.forward * 4.0f);
             }
             Destroyable destroyable = hit.transform.GetComponentInChildren <Destroyable>();
             if (destroyable)
             {
                 destroyable.Explode(hit.point);
             }
             Terminatable terminatable = hit.transform.GetComponentInChildren <Terminatable>();
             if (terminatable)
             {
                 terminatable.Hit(Random.Range(0, 47), this.transform);
             }
             Damageable damageable;
             if ((damageable = hit.transform.GetComponent <Damageable>()) != null || (damageable = hit.transform.root.GetComponent <Damageable>()) != null)
             {
                 damageable.Damage(hit);
             }
             Rigidbody rigidbody = hit.transform.GetComponentInChildren <Rigidbody>();
             if (rigidbody)
             {
                 rigidbody.AddForceAtPosition(Camera.main.transform.forward * 100.0f, hit.point);
             }
         }
     }
 }
コード例 #2
0
ファイル: ThinkReceipe.cs プロジェクト: sen866/action_lib
 public ThinkReceipe(ConditionGroup _conditions, Actable _action)
 {
     Conditions  = _conditions;
     ThinkAction = _action;
 }