void FixedUpdate()
    {
        if (!mUsed)
        {
            //see if there is a player in front of us
            GameObject target = Utils.GetPlayerInConeInFront(gameObject, 100, 50);

            if (target)
            {
                if (!target.GetComponent <PlayerPickupManager>().GetHit())                //see if we miss because of armor
                {
                    Notifier.BigNotifyPlayer(gameObject, "Blocked by armor!");
                    Destroy(this);
                    return;
                }

                mUsed = true;

                //notify player
                Notifier.BigNotifyPlayer(gameObject, "Player hooked!");

                //notify target
                Notifier.BigNotifyPlayer(target, "You got hooked!");

                //graphical representation
                GameObject hook = (GameObject)Network.Instantiate(Resources.Load("Hook"), Vector3.zero, Quaternion.identity, 3);
                hook.GetComponent <NetworkView>().RPC("SetTargets", RPCMode.All, GetComponent <NetworkView>().viewID, target.GetComponent <NetworkView>().viewID);

                Destroy(this);
            }
        }
    }
Esempio n. 2
0
    void Update()
    {
        if (!mUsed)
        {
            //see if there is a player in front of us
            GameObject target = Utils.GetPlayerInConeInFront(gameObject, 100, 50);

            if (target)
            {
                if (!target.GetComponent <PlayerPickupManager>().GetHit())                //see if we miss because of armor
                {
                    Notifier.BigNotifyPlayer(gameObject, "Blocked by armor!");
                    Destroy(this);
                    return;
                }

                mUsed = true;

                //notify player
                Notifier.BigNotifyPlayer(gameObject, "Initiating position swap!");

                //notify target
                Notifier.BigNotifyPlayer(target, "Initiating position swap!");

                StartCoroutine(StartPositionSwap(target));
            }
        }
    }
Esempio n. 3
0
    void OnGUI()
    {
        if (Network.isServer && GUI.Button(new Rect(115, 40, 80, 20), "New Level"))
        {
            Notifier.GlobalNotify("Generating new level...");

            foreach (GameObject player in GameObject.FindGameObjectsWithTag("Player"))
            {
                Notifier.BigNotifyPlayer(player, "Generating new level...");
            }

            DestroyLevelChunks(false);
            //networkView.RPC("DestroyLevelChunks", RPCMode.Others);
            GenerateLevel();
        }
    }
Esempio n. 4
0
    void CrossedFinish(float raceTime)
    {
        mHasFinished = true;

        if (Utils.IsABot(gameObject))
        {
            GetComponent <AIController>().RemoveControl();
        }
        else
        {
            GetComponent <PlayerController>().RemoveControl();
        }

        mRaceTime = raceTime;

        if (Utils.IsLocalPlayer(gameObject, false))
        {
            Notifier.BigNotifyPlayer(gameObject, "Finished!");
        }
    }
Esempio n. 5
0
    IEnumerator ReverseControls()
    {
        if (Utils.IsLocalPlayer(gameObject, false))
        {
            SoundManager.GetSingleton().Spawn2DSound(SFXType.InvertControls);
        }

        transform.Find("GRP_InvertedControls/InvertedControls").GetComponent <Renderer>().enabled = true;

        yield return(new WaitForSeconds(0.2f));

        mReversedControls = true;
        yield return(new WaitForSeconds(5));

        Notifier.BigNotifyPlayer(gameObject, "Controls normal again");
        yield return(new WaitForSeconds(0.2f));

        mReversedControls = false;

        transform.Find("GRP_InvertedControls/InvertedControls").GetComponent <Renderer>().enabled = false;
    }
Esempio n. 6
0
    void Start()
    {
        Network.Instantiate(Resources.Load("Mortar"), transform.position, Quaternion.identity, 3);

        playersToHit = new GameObject[Utils.GetNumPlayers()];

        float playerPosOnTrack = GetComponent <PlayerPlace>().GetPosOnTrack();

        //notify all players
        foreach (GameObject player in GameObject.FindGameObjectsWithTag("Player"))
        {
            if (player.GetComponent <PlayerPlace>().GetPosOnTrack() >= playerPosOnTrack)
            {
                playersToHit[currentPosInArray] = player;
                currentPosInArray++;
                Notifier.BigNotifyPlayer(player, "Incoming mortar!!");
            }
        }

        StartCoroutine(GetReadyToBomb());
    }
    void Update()
    {
        //see if there is a player in front of us
        GameObject target = Utils.GetPlayerInConeInFront(gameObject, 100, 50);

        if (target)
        {
            if (!target.GetComponent <PlayerPickupManager>().GetHit())            //see if we miss because of armor
            {
                Notifier.BigNotifyPlayer(gameObject, "Blocked by armor!");
                Destroy(this);
                return;
            }

            if (!Utils.IsABot(target))
            {
                target.GetComponent <NetworkView>().RPC("TriggerReverseControls", RPCMode.All);
            }
            else
            {
                target.GetComponent <NetworkView>().RPC("TriggerAIReverseControls", RPCMode.All);
            }

            //notify player
            Notifier.BigNotifyPlayer(gameObject, "Target controls reversed!");

            //notify target
            Notifier.BigNotifyPlayer(target, "Controls reversed!");

            if (Utils.IsLocalPlayer(gameObject, false))
            {
                SoundManager.GetSingleton().Spawn2DSound(SFXType.InvertControls);
            }

            Destroy(this);             //remove script
        }
    }