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);
    }
Exemplo n.º 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
        }
    }
Exemplo n.º 3
0
    private void Awake()
    {
        playerBehavior player = playerBehavior.current;

        playerShootingBehavior.current = this;
        this.projectileBuffType        = "none";
        currentProjectile = playerProjectile;
    }
Exemplo n.º 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>();
 }
Exemplo n.º 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;
 }
Exemplo n.º 6
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        playerBehavior player = collider.GetComponent <playerBehavior>();

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

        instance = this;

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