示例#1
0
    void Update()
    {
        // The other player may not be available at Start, so do it on update until we can find them
        if (!otherPlayer || !thisPlayer)
        {
            GameObject[] gos;
            gos = GameObject.FindGameObjectsWithTag("Player");

            foreach (GameObject go in gos)
            {
                PlayerIdentity id = go.GetComponent <PlayerIdentity>();
                if (id)
                {
                    if (!id.IsThisPlayer())
                    {
                        otherPlayer = go;
                    }
                    else
                    {
                        thisPlayer = go;
                    }

                    if (id.IsHunter())
                    {
                        hunter = go;
                    }
                    else
                    {
                        seeker = go;
                    }
                }
            }
        }
    }
    public virtual void OnTriggerStay(Collider other)
    {
        if (other.gameObject.tag == "Player" && Input.GetButtonUp("Fire1"))
        {
            PlayerIdentity id = other.gameObject.GetComponent <PlayerIdentity>();

            // Need to make sure that the input only affects the appropriate player
            if (id.IsThisPlayer())
            {
                if (id.IsHunter())
                {
                    this.HunterInteraction(other);
                }
                else
                {
                    this.SeekerInteraction(other);
                }
            }
        }
    }
示例#3
0
    void Update()
    {
        if (id.IsHunter() || !id.IsThisPlayer())
        {
            return;
        }

        if (sprintCooldownTimer >= sprintCooldownTime && Input.GetButtonUp("Fire2"))
        {
            sprinting           = true;
            sprintCooldownTimer = 0;
            movement.StartSprint();
            sfxManager.PlaySprint();
        }

        if (sprinting)
        {
            if (sprintTimer < sprintDuration)
            {
                sprintTimer += Time.deltaTime;
            }
            else if (sprintTimer >= sprintDuration)
            {
                movement.StopSprint();
                sprintTimer = 0;
                sprinting   = false;
            }
        }
        else
        {
            if (sprintCooldownTimer < sprintCooldownTime)
            {
                sprintCooldownTimer += Time.deltaTime;
            }
        }

        UIManager.instance.UpdateProgress((sprintCooldownTimer / sprintCooldownTime) * 100);
        ui.SetProgress((sprintCooldownTimer / sprintCooldownTime) * 100);
    }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        if (!id.IsHunter() || !id.IsThisPlayer())
        {
            return;
        }

        // May not be available on start, so we'll do it here instead
        if (!hidingManager)
        {
            if (PlayerManager.instance.otherPlayer)
            {
                hidingManager = PlayerManager.instance.otherPlayer.GetComponent <HidingManager>();
            }
        }

        if (echoCooldownTimer >= echoCooldownTime && Input.GetButtonUp("Fire2"))
        {
            UseEcho();
            echoCooldownTimer         = 0;
            echoMovementCooldownTimer = 0;
        }

        if (echoCooldownTimer < echoCooldownTime)
        {
            echoCooldownTimer += Time.deltaTime;
        }

        // Don't let the player move for a short time after using this ability
        if (echoMovementCooldownTimer < echoMovementCooldownTime)
        {
            echoMovementCooldownTimer += Time.deltaTime;
        }

        UIManager.instance.UpdateProgress((echoCooldownTimer / echoCooldownTime) * 100);
        ui.SetProgress((echoCooldownTimer / echoCooldownTime) * 100);
    }
示例#5
0
    void Start()
    {
        PlayerIdentity id = GetComponent <PlayerIdentity>();

        thisIsHunter = id.IsHunter() && id.IsThisPlayer();
    }
示例#6
0
    bool validateStatus(Collider other)
    {
        if (ReferenceEquals(other, null))
        {
            return(false);
        }

        PlayerIdentity otherId       = other.gameObject.GetComponent <PlayerIdentity>();
        HidingManager  hidingManager = other.gameObject.GetComponent <HidingManager>();

        if (ReferenceEquals(hidingManager, null))
        {
            return(false);
        }

        // If the hunter clicks they can take the seeker out of hiding
        // All of this stuff needs to be synced to the server instead of just hopefully lining up

        // If the current player is the hunter and the collider they've run into is the Seeker and the Seeker isn't in hiding
        return(thisIsHunter && other.gameObject.tag == "Player" && otherId.IsSeeker() && !otherId.IsThisPlayer() && !hidingManager.IsHiding());
    }