Exemplo n.º 1
0
    void OnCollisionEnter(Collision col)
    {
        if (targetPlayer != null)
        {
            targetShip = targetPlayer.GetComponent<HullOnline>();

            if (col.transform.GetComponent<HullOnline>() != null)
            {
                collidedHull = col.transform.GetComponent<HullOnline>();
            }
            if (collidedHull && targetShip == collidedHull)
            {
                //print("Colliding With Ship!!!");
                targetShip.Damage(targetPlayer.transform.position, targetShip.CurrentHealth, 5);
                if (targetShip.CurrentHealth <= 0)
                {
                    targetPlayer = null;
                    switchState(this, states[0]);
                    //print("Switching State to: WANDER");
                }
            }
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        shipScript = GetComponent<ShipScript>();
        rb = GetComponent<Rigidbody>();
        pfx = GetComponent<PlayerFX>();
        playerRespawn = GetComponent<PlayerRespawn>();
        hullOnline = GetComponent<HullOnline>();
        hullOnline.RB = rb;
        hullOnline.SetBuoyancy = GetComponent<BuoyancyScript>();

        Reset();
    }