コード例 #1
0
ファイル: CoreObject.cs プロジェクト: AyeeCaramba/Rextuff
    void OnCollisionEnter2D(Collision2D collision)
    {
        // When we collide with an object, check its components.
        // Then add it to the appropriate lists.
        PlayerController pc = collision.gameObject.GetComponent <PlayerController>();
        BulletMotor      bm = collision.gameObject.GetComponent <BulletMotor>();
        Rigidbody2D      rb = collision.gameObject.GetComponent <Rigidbody2D>();

        if (pc != null)
        {
            BaseOnPlayerCollision(pc);
        }
        if (bm != null)
        {
            BaseOnBulletCollision(bm);
        }
        if (rb != null)
        {
            BaseOnRigidbodyCollision(rb);
        }
    }
コード例 #2
0
ファイル: CoreObject.cs プロジェクト: AyeeCaramba/Rextuff
    void OnCollisionExit2D(Collision2D collision)
    {
        // When we stop colliding with an object, check its components.
        // Then remove it from the appropriate lists.
        PlayerController pc = collision.gameObject.GetComponent <PlayerController>();
        BulletMotor      bm = collision.gameObject.GetComponent <BulletMotor>();
        Rigidbody2D      rb = collision.gameObject.GetComponent <Rigidbody2D>();

        if (pc != null)
        {
            BaseOnPlayerExit(pc);
        }
        if (bm != null)
        {
            BaseOnBulletExit(bm);
        }
        if (rb != null)
        {
            BaseOnRigidbodyExit(rb);
        }
    }
コード例 #3
0
ファイル: SpaceShipMotor.cs プロジェクト: mrimsh/SpaceTrial
 void BulletWasCollided(BulletMotor bullet)
 {
     SpaceShipMotor playerShip = gm.playerShip;
     if (bullet.sourceShip == playerShip && this != playerShip) {
         DamageShip (bullet.damage, DamageSource.Player);
         bullet.BulletCatched ();
     } else if (bullet.sourceShip != playerShip && this == playerShip) {
         DamageShip (bullet.damage, DamageSource.Player);
         bullet.BulletCatched ();
     }
 }
コード例 #4
0
ファイル: CoreObject.cs プロジェクト: AyeeCaramba/Rextuff
 protected virtual void OnBulletExit(BulletMotor bullet)
 {
 }
コード例 #5
0
ファイル: CoreObject.cs プロジェクト: AyeeCaramba/Rextuff
 protected virtual void BulletUpdate(BulletMotor bullet)
 {
 }
コード例 #6
0
ファイル: CoreObject.cs プロジェクト: AyeeCaramba/Rextuff
 protected virtual void OnBulletCollision(BulletMotor bullet)
 {
 }
コード例 #7
0
ファイル: CoreObject.cs プロジェクト: AyeeCaramba/Rextuff
 void BaseOnBulletExit(BulletMotor bullet)
 {
     collidingBullets.Remove(bullet);
     OnBulletExit(bullet);
 }
コード例 #8
0
ファイル: CoreObject.cs プロジェクト: AyeeCaramba/Rextuff
 void BaseOnBulletCollision(BulletMotor bullet)
 {
     collidingBullets.Add(bullet);
     OnBulletCollision(bullet);
 }