コード例 #1
0
ファイル: CannonBall.cs プロジェクト: Shinto-Studios/ShipAhoy
    // ----- Engine funktioner ----- \\

    private void OnCollisionEnter(Collision collision)
    {
        if (networkMaster == true)
        {
            IShip ship = collision.gameObject.GetComponent <IShip>();

            if (ship != null)
            {
                if (ship != firedFromShip)
                {
                    ship.ApplyDamage(firedFromShip.GetCannonDamage());

                    firedFromShip.GetGameManager().OnCannonBallDestroyed(this);
                }
            }
            else
            {
                Mine mine = collision.gameObject.GetComponent <Mine>();

                if (mine != null)
                {
                    mine.MineDestroyed();
                }

                firedFromShip.GetGameManager().OnCannonBallDestroyed(this);
            }
        }
    }
コード例 #2
0
    ///<summary>Prøver at skyde vores kanoner</summary>
    public void ShootCannon()
    {
        if (nextFireReady <= 0.0f)
        {
            nextFireReady = parentShip.GetCannonNextFire();

            parentShip.GetGameManager().SpawnCannonBalls(parentShip, firePoint.transform.position, firePoint.transform.rotation, true);
        }
    }