void Update() { if (id.IsHunter() && hunterSprite) { if (inWater) { // TODO: Lerp getting in and out of the water hunterSprite.transform.position = transform.position + new Vector3(0, hunterOffset / 2, 0); } else { hunterSprite.transform.position = transform.position + new Vector3(0, hunterOffset, 0); } } else if (seekerSprite) { if (inWater) { seekerSprite.transform.position = transform.position + new Vector3(0, seekerOffset / 2, 0); } else { seekerSprite.transform.position = transform.position + new Vector3(0, seekerOffset, 0); } } }
float GetCurrentSpeed() { float currentSpeed = defaultSpeed; if (id.IsHunter()) { currentSpeed = hunterSpeed; } // If they're sneaking through the grass if (hidingManager.IsHidingMovable()) { currentSpeed = defaultSpeed / 2; } if (inWater) { currentSpeed *= waterSpeedModifier; } if (sprinting) { currentSpeed *= sprintingSpeedModifier; } return(currentSpeed); }
void Start() { if (!GameObject.Find("Hunter Sprite")) { return; } id = GetComponent <PlayerIdentity>(); if (id) { if (id.IsHunter()) { spriteRenderer = GameObject.Find("Hunter Sprite").GetComponent <Renderer>(); } else { spriteRenderer = GameObject.Find("Seeker Sprite").GetComponent <Renderer>(); } } else { spriteRenderer = GetComponent <Renderer>(); } }
void OnGUI() { Scene scene = SceneManager.GetActiveScene(); if (scene.name == "hunterVictory" || scene.name == "seekerVictory") { return; } // Player manager doesn't have the players on start if (!id) { if (PlayerManager.instance.thisPlayer) { thisPlayer = PlayerManager.instance.thisPlayer; id = thisPlayer.GetComponent <PlayerIdentity>(); movement = thisPlayer.GetComponent <PlayerMovement3D>(); } } // if (id && id.IsSeeker()) { // DrawSeekerUI(); // } if (id && id.IsHunter()) { DrawHunterUI(); } // DrawMinimap(); }
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; } } } } }
void Start() { PlayerIdentity id = transform.parent.GetComponent <PlayerIdentity>(); SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>(); if (id.IsHunter()) { spriteRenderer.sprite = hunterSprite; } else { spriteRenderer.sprite = seekerSprite; } }
void Start() { if (!GameObject.Find("Hunter Sprite")) { return; } id = GetComponent<PlayerIdentity>(); if (id) { if (id.IsHunter()) { spriteRenderer = GameObject.Find("Hunter Sprite").GetComponent<Renderer>(); } else { spriteRenderer = GameObject.Find("Seeker Sprite").GetComponent<Renderer>(); } } else { spriteRenderer = GetComponent<Renderer>(); } }
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); } } } }
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); }
// 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); }
void Start() { PlayerIdentity id = GetComponent <PlayerIdentity>(); thisIsHunter = id.IsHunter() && id.IsThisPlayer(); }