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);
    }
Example #2
0
    // 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
        }
    }
Example #3
0
    private void Awake()
    {
        playerBehavior player = playerBehavior.current;

        playerShootingBehavior.current = this;
        this.projectileBuffType        = "none";
        currentProjectile = playerProjectile;
    }
Example #4
0
 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>();
 }
Example #5
0
 //Awake Function
 private void Awake()
 {
     playerBehavior.current = this;
     this.playerBuffTime    = Time.time;
     this.playerSpeed       = this.playerSpeedDefault;
     this.playerBuffType    = "none";
     this.currentLife       = this.startingLife;
 }
Example #6
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        playerBehavior player = collider.GetComponent <playerBehavior>();

        if (player != null)
        {
            player.Health(-1);
            this.GetComponent <EnemyProperties>().health -= 10;
        }
    }
Example #7
0
    //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);
        }
    }
Example #8
0
 //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;
     }
 }
Example #9
0
    //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);
        }
    }
Example #10
0
    // 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
        }
    }
Example #11
0
 void Start()
 {
     playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <playerBehavior>();
 }
Example #12
0
 private void getMatValues()
 {
     player = GameObject.Find("Player").GetComponent <playerBehavior>();
 }
Example #13
0
 // Use this for initialization
 protected void onStart()
 {
     player = GameObject.Find("playerCTRL").GetComponent <playerBehavior> ();
     speed  = -player.keySpeed;
 }
Example #14
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.Find("playerCTRL").GetComponent <playerBehavior> ();
 }
Example #15
0
 // Use this for initialization
 void Start()
 {
     anima  = this.GetComponent <Animation> ();
     player = GameObject.Find("playerCTRL").GetComponent <playerBehavior> ();
     //setStay ();
 }
Example #16
0
    void Awake()
    {
        Screen.showCursor = false;

        instance = this;

        body = GetComponent ("Rigidbody") as Rigidbody;
        body.freezeRotation = true;
        body.useGravity = useG;
    }
Example #17
0
 // Use this for initialization
 void Start()
 {
     timerGen = genTime;
     player   = GameObject.Find("playerCTRL").GetComponent <playerBehavior> ();
 }
Example #18
0
 // Use this for initialization
 void Start()
 {
     parent = GetComponentInParent <playerBehavior>();
 }
Example #19
0
 private void Awake()
 {
     current = this;
 }
Example #20
0
 // Use this for initialization
 void Start()
 {
     player       = GameObject.Find("playerCTRL").GetComponent <playerBehavior> ();
     rawEgg       = GameObject.Find("rawEgg");
     eggShellCopy = GameObject.Find("eggShell_copy");
 }