Example #1
0
 public override void Effect(PlayerID hitPlayer)
 {
     //applies explosive force iff a player was hit
     if (hitPlayer != 0)
     {
         Player.Controller hitPlayerController = Data.GameManager.instance.GetPlayer(hitPlayer);
         hitPlayerController.GetComponent <Rigidbody>().AddExplosionForce(HeavyKnockbackForce, transform.position, HeavyKnockbackRadius);
     }
 }
Example #2
0
 public override void Effect(PlayerID hitPlayer)
 {
     //applies knockback force iff a player was hit
     if (hitPlayer != 0)
     {
         Player.Controller hitPlayerController = Data.GameManager.instance.GetPlayer(hitPlayer);
         //hitPlayerController.GetComponent<Rigidbody>().AddExplosionForce(HeavyKnockbackForce, transform.position, HeavyKnockbackRadius);
         hitPlayerController.GetComponent <Rigidbody>().AddForce(Vector3.Normalize(transform.forward) * DELTA_V, ForceMode.VelocityChange);
     }
 }
Example #3
0
        private void BallStatusChanged(byte previousStatus, byte status)
        {
            // If neutral
            if (status == 0)
            {
                parented   = false;
                LocalOwner = null;
            }
            // If dropped
            else if (status == 1)
            {
                parented   = false;
                LocalOwner = null;
            }
            // If reset
            else if (status == 2)
            {
                parented   = false;
                LocalOwner = null;
            }
            // If touchdown
            else if (status == 3)
            {
                // Set the player's camera to the position of the player who touchdown
                Player.Networker.Instance.Controller.Camera.FollowPosition = LocalOwner.CameraPosition;

                //parented = false;
                //LocalOwner = null;

                parented = true;
                //LocalOwner = SpawnManager.GetPlayerObject(nv_BallOwner.Value).GetComponent<Player.Networker>().Controller;
                LocalOwner = PlayerMethods.GetPlayerObjectByOwnerID(nv_BallOwner.Value).GetComponent <Player.Networker>().Controller;
                ownerBallParentPosition = LocalOwner.BallParentPosition;
            }
            // If picked up
            else if (status == 4)
            {
                parented = true;
                //LocalOwner = SpawnManager.GetPlayerObject(nv_BallOwner.Value).GetComponent<Player.Networker>().Controller;
                LocalOwner = PlayerMethods.GetPlayerObjectByOwnerID(nv_BallOwner.Value).GetComponent <Player.Networker>().Controller;
                ownerBallParentPosition = LocalOwner.BallParentPosition;
            }
        }
Example #4
0
        private void OnTriggerEnter(Collider col)
        {
            if (col.GetComponent <Player.Controller>())
            {
                Player.Controller c = col.GetComponent <Player.Controller>();

                var controller = col.GetComponent <Player.Controller>();
                if (controller == null)
                {
                    return;
                }

                if (!controller.Networker.IsOwner)
                {
                    return;
                }

                if (Ball.Instance.LocalOwner == controller)
                {
                    Debug.Log("Scoring ball");
                    Ball.Instance.InvokeServerRpc("Score", channel: "Reliable");
                }
            }
        }