コード例 #1
0
 private void OnTriggerStay(Collider other)
 {
     if (Attacking && !hitObject.Contains(other.gameObject.transform.root))
     {
         if (((1 << other.gameObject.layer) & layerMask) != 0)
         {
             hitObject.Add(other.gameObject.transform.root);
             if (other.GetComponentInParent <MonsterBasic>())
             {
                 MonsterBasic monster = other.gameObject.GetComponentInParent <MonsterBasic>();
                 monster.Damaged(AttackDamage, other.ClosestPoint(transform.position));
                 // Quaternion r = p.rotation;
                 // r.y = -r.y
                 GameObject g = Instantiate(HitParticle, other.ClosestPoint(transform.position), Quaternion.identity);
                 Destroy(g, DestroyTime);
             }
             else if (other.GetComponent <PlayerHP>())
             {
                 PlayerHP playerHP = other.gameObject.GetComponent <PlayerHP>();
                 playerHP.Damaged(AttackDamage);
                 if (playerHP.Invulnerability)
                 {
                     return;
                 }
                 GameObject g = Instantiate(HitParticle, other.ClosestPoint(transform.position), Quaternion.identity);
                 Destroy(g, DestroyTime);
             }
         }
     }
 }
コード例 #2
0
 public static MonsterBasic getInstance()
 {
     if (_instance == null)
     {
         _instance = new MonsterBasic();
         Debug.Log("MonsterBasic component forget to declaration itself.");
     }
     return(_instance);
 }
コード例 #3
0
 public MonsterProxy() : base(NAME)
 {
     Data = new MonsterBasic();
 }