private bool checkGameOver() { bool atLeastOneCanGo = false; // foreach (playerBehavior playerScript in players) { // atLeastOneCanGo = atLeastOneCanGo || playerScript.canGo (true); // } // return !atLeastOneCanGo; // // if player cannot go // if this player is losing, game over // else game is not over? // //if a player can no longer move, game is over for (int i = 0; i < players.Length; i++) { playerBehavior playerScript = players [i]; bool playerCanGo = playerScript.canGo(true); atLeastOneCanGo = atLeastOneCanGo || playerCanGo; if (!playerCanGo) { if (score [i] < score [(i + 1) % 2] && !(Input.GetMouseButton(0))) { return(true); //this player stupidly locked himself out while losing so game over } } } return(!atLeastOneCanGo); }
// Update is called once per frame void Update() { playerBehavior player = playerBehavior.current; shieldsLeft.text = player.shield.ToString(); //Checking for shield buff if (player.playerBuffType == "shield") { progress.fillAmount = 1f - (Time.time - player.playerBuffTime) / player.maxPlayerBuffTimer; //Check if Buff time is over if (Time.time - player.playerBuffTime >= player.maxPlayerBuffTimer || player.shield == 0) { player.ShieldDown(); //Deactivate speed buff when time is up player.playerBuffType = "none"; playerPowerUpSlot.current.NoBuff(); //Empties powerup slot } } else { //If speed buff is inactive, disable speed icon player.ShieldDown(); //Function to remove shield UIMaster.current.shieldicon.SetActive(false); //Function to remove UI Shield Icon } }
private void Awake() { playerBehavior player = playerBehavior.current; playerShootingBehavior.current = this; this.projectileBuffType = "none"; currentProjectile = playerProjectile; }
void Start() { selectedObject = GameObject.Find("Floor"); //instantiate to "no selection" navigable = LayerMask.GetMask("Floor"); interactable = LayerMask.GetMask("Interactable"); cam = Camera.main; player = GameObject.Find("Player").GetComponent <playerBehavior>(); }
//Awake Function private void Awake() { playerBehavior.current = this; this.playerBuffTime = Time.time; this.playerSpeed = this.playerSpeedDefault; this.playerBuffType = "none"; this.currentLife = this.startingLife; }
void OnTriggerEnter2D(Collider2D collider) { playerBehavior player = collider.GetComponent <playerBehavior>(); if (player != null) { player.Health(-1); this.GetComponent <EnemyProperties>().health -= 10; } }
//Checks for collision of power up with player, destroys when condition fufilled private void OnTriggerEnter2D(Collider2D collision) { playerBehavior player = collision.GetComponent <playerBehavior>(); if (player != null) { player.playerBuffType = "speed"; //Changes active buff to speed player.playerBuffTime = Time.time; //Records buff time player.IncreaseSpeed(); //Function to increase speed UIMaster.current.speedicon.SetActive(true); // Activates speed timer playerPowerUpSlot.current.SpeedBuff(); //Changes visual powerup slot around player to speed Destroy(this.gameObject); } }
//Awake Function private void Awake() { playerBehavior.current = this; this.playerBuffTime = Time.time; this.playerSpeed = this.playerSpeedDefault; this.playerBuffType = "none"; if (GlobalSceneManager.save != true) { this.currentLife = this.startingLife; } else { this.currentLife = GlobalSceneManager.current.savedHealth; } }
//Checks for collision of power up with player, destroys when condition fufilled private void OnTriggerEnter2D(Collider2D collision) { playerBehavior player = collision.GetComponent <playerBehavior>(); //Shield Power-up if (player != null) { player.playerBuffType = "shield"; //Changes active buff to shield player.playerBuffTime = Time.time; //Records buff time player.ShieldUp(); //Function to shield up UIMaster.current.shieldicon.SetActive(true); //Activate shield timer, need to add shield hit count also playerPowerUpSlot.current.ShieldBuff(); //Changes visual powerup slot Destroy(this.gameObject); } }
// Update is called once per frame void Update() { playerBehavior player = playerBehavior.current; //Checking for speed buff if (player.playerBuffType == "speed") { progress.fillAmount = 1f - (Time.time - player.playerBuffTime) / player.maxPlayerBuffTimer; //Check if Buff time is over if (Time.time - player.playerBuffTime >= player.maxPlayerBuffTimer) { player.ReturnSpeed(); //Deactivate speed buff when time is up player.playerBuffType = "none"; playerPowerUpSlot.current.NoBuff(); //Empty power-up slot } } else { //If speed buff is inactive, disable speed icon player.ReturnSpeed(); //Function to change player speed back to normal UIMaster.current.speedicon.SetActive(false); //Disable Speed UI icon } }
void Start() { playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <playerBehavior>(); }
private void getMatValues() { player = GameObject.Find("Player").GetComponent <playerBehavior>(); }
// Use this for initialization protected void onStart() { player = GameObject.Find("playerCTRL").GetComponent <playerBehavior> (); speed = -player.keySpeed; }
// Use this for initialization void Start() { player = GameObject.Find("playerCTRL").GetComponent <playerBehavior> (); }
// Use this for initialization void Start() { anima = this.GetComponent <Animation> (); player = GameObject.Find("playerCTRL").GetComponent <playerBehavior> (); //setStay (); }
void Awake() { Screen.showCursor = false; instance = this; body = GetComponent ("Rigidbody") as Rigidbody; body.freezeRotation = true; body.useGravity = useG; }
// Use this for initialization void Start() { timerGen = genTime; player = GameObject.Find("playerCTRL").GetComponent <playerBehavior> (); }
// Use this for initialization void Start() { parent = GetComponentInParent <playerBehavior>(); }
private void Awake() { current = this; }
// Use this for initialization void Start() { player = GameObject.Find("playerCTRL").GetComponent <playerBehavior> (); rawEgg = GameObject.Find("rawEgg"); eggShellCopy = GameObject.Find("eggShell_copy"); }