Ejemplo n.º 1
0
 //Checks to see if current or previosu rank is higher
 private bool CheckRating()
 {
     Debug.Log("compare");
     for (int i = 0; i < AMS_ScoreController.letterRanks.Length; i++)
     {
         if (PlayerPrefs.GetString(saveLevelInfo) == AMS_ScoreController.letterRanks[i])
         {
             oldRank = i;
         }
         if (AMS_ScoreController.GetScoreRank() == AMS_ScoreController.letterRanks[i])
         {
             newRank = i;
         }
         //Incase a non valaid rank is earned it can be overwritten.
         if (PlayerPrefs.GetString(saveLevelInfo) == "" || PlayerPrefs.GetString(saveLevelInfo) == "6")
         {
             return(true);
         }
     }
     if (oldRank < newRank)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 2
0
    private void OnTriggerEnter(Collider other)
    {
        if (!movingUp && other.name == "MainPlayer")
        {
            AMS_ScoreController.increaseScore(scoreGainedOnCollection);
            var resourceController = GameObject.Find("Resource_Controller").GetComponent <AMS_ResourceController>();
            if (resourceController != null)
            {
                resourceController.currentResources   += resourceValue;
                resourceController.addedResources.text = "+ " + resourceValue;
                {
                    StartCoroutine("InstantResourceGuiTimer");
                    //  Debug.Log("Coroutine has started");
                }
            }
            else
            {
                Debug.Log("Can't find resource controller");
            }
            var aSwitcher = other.GetComponent <AudioSwitcherScript>();
            if (aSwitcher != null)
            {
                aSwitcher.PlaySound(pickupSound);
            }
            else
            {
                Debug.Log("can't find audio switcher");
            }

            movingUp = true;
        }
    }
Ejemplo n.º 3
0
 public void OpenDoor()
 {
     AMS_ScoreController.increaseScore(scoreGainedUponOpening);
     moving = true;
     moved  = true;
     // DoorAudioSource.clip = DoorSounds[0];
     // DoorAudioSource.Play();
 }
Ejemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     if (WereScoresDeleted == true)
     {
         AMS_ScoreController.GetScoreRank();
         Debug.Log("Ranks should disappear");
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
     }
 }
Ejemplo n.º 5
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Door")
        {
            AMS_ScoreController.increaseScore(scoreGainedOnDeposit);

            Destroy(gameObject);
            //increment resource pool in here some where
        }
    }
Ejemplo n.º 6
0
 public void OpenDoor()
 {
     AMS_ScoreController.increaseScore(scoreGainedUponOpening);
     moving = true;
     moved  = true;
     DoorAudioSource.clip = DoorSounds[0];
     DoorAudioSource.Play();
     SetSpawnPoints(spawnPointsDisable, false);
     SetSpawnPoints(spawnPointsEnable, true);
 }
Ejemplo n.º 7
0
 private void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         PowerupPFI();
         AMS_ScoreController.increaseScore(scoreGainedOnPickup);
         col.GetComponent <AMS_GunManagement>().powerup       = powerupName;
         col.GetComponent <AMS_GunManagement>().powerupLength = powerupLength;
         col.GetComponent <AMS_GunManagement>().powerupMax    = powerupLength;
         GameObject.FindObjectOfType <AudioSwitcherScript>().PlaySound(powerupSound);
         Destroy(gameObject);
     }
 }
    //Used for trigger the death Sequence
    //KAE - a note on (string type). it doesn't seem to be used so I put "default" as the type on my TakeDamageUnfair() script.
    public void Death(string type)
    {
        ModifyScoreGain(type);
        //Increase Score
        if (scoreGainedOnDeath != 0)
        {
            AMS_ScoreController.increaseScore(scoreGainedOnDeath);
        }
        //Specialized Deaths
        if (gameObject.tag == "Player")
        {
            Debug.Log("Player DieDied");
            ignoreDestroy = true;
            playerDead    = true;
            amDead        = true;
        }
        if (gameObject.tag == "Default_Enemy")
        {
            if (boss == true)
            {
                bossDead = true;
            }
            DefaultEnemyDeath();
        }

        /*  if (gameObject.tag == "StaticDefence")
         * {
         *    ignoreDestroy = false;
         * }
         * if(gameObject.tag == "Turret")
         * {
         *  //  ignoreDestroy = false;
         * }*/
        if (gameObject.tag == "Target")
        {
            TargetDeath();
        }
        if (gameObject.GetComponent <AMS_Hive>() != null)
        {
            gameObject.GetComponent <AMS_Hive>().LastHive();
        }
        //Default Death
        if (!ignoreDestroy)
        {
            if (gameObject.tag != "Hazard")
            {
                Destroy(gameObject);
            }
        }
    }
Ejemplo n.º 9
0
 private void DisplayNewInfo(int i)
 {
     //Original Score
     if (i == 0)
     {
         resultText[0].text = "Score earned: " + AMS_ScoreController.score;
     }
     //Par Time
     if (i == 1)
     {
         resultText[1].text = "Par Time: " + ((int)AMS_ScoreController.parTimes[0] / 60).ToString() + ":" + (AMS_ScoreController.parTimes[0] % 60).ToString("f0");
     }
     //Time Taken
     if (i == 2)
     {
         resultText[2].text = "Time Taken: " + ((int)AMS_ScoreController.timeTaken / 60).ToString() + ":" + (AMS_ScoreController.timeTaken % 60).ToString("f0");
     }
     //Time Bonus Earned
     if (i == 3)
     {
         AMS_ScoreController.CompareTimeToPar();
         resultText[3].text = "Time Bonus Earned: " + AMS_ScoreController.timeBonusEarned;
     }
     //Failure Text
     if (i == 4)
     {
         if (!AMS_ScoreController.victory)
         {
             resultText[4].text        = "Score Failure Multiplier: 0%";
             AMS_ScoreController.score = 0;
         }
         else
         {
             moreInfoTime = 0;
         }
     }
     //Final Score
     if (i == 5)
     {
         resultText[5].text = "Final Score: " + AMS_ScoreController.score;
     }
     //Rank
     if (i == 6)
     {
         resultText[6].text = AMS_ScoreController.GetScoreRank();
         SaveScore();
         goTolevelSelectButton.SetActive(true);
     }
 }
Ejemplo n.º 10
0
 private void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         if (gun != null)
         {
             gun.AddAmmo(type);
         }
         AMS_ScoreController.increaseScore(scoreGainedOnPickup);
         if (powerupSound != null)
         {
             GameObject.FindObjectOfType <AudioSwitcherScript>().PlaySound(powerupSound);
         }
         Destroy(gameObject);
     }
 }
Ejemplo n.º 11
0
    void Update()
    {
        var dist = Vector3.Distance(transform.position, baseHealth.transform.position);

        if (dist <= baseDepositRange)
        {
            AMS_ScoreController.increaseScore(resourceValue);
            //increment resource pool in here some where

            resourceController.currentResources   += resourceValue;
            resourceController.addedResources.text = "+ " + resourceValue; //added GUI update
            {
                StartCoroutine("GuiTimer");
            }
            Destroy(gameObject);
        }
    }
Ejemplo n.º 12
0
 //Save the score value
 private void SaveScore()
 {
     saveLevelInfo = "Score " + AMS_ScoreController.lastSceneName;
     //Check that the currently saved score is not higher
     if (PlayerPrefs.HasKey(saveLevelInfo))
     {
         if (CheckRating())
         {
             Debug.Log("New is higher");
             PlayerPrefs.SetString(saveLevelInfo, AMS_ScoreController.GetScoreRank());
         }
         else
         {
             Debug.Log("Old is higher");
         }
     }
     else
     {
         Debug.Log("First time saving here");
         PlayerPrefs.SetString(saveLevelInfo, AMS_ScoreController.GetScoreRank());
     }
 }
Ejemplo n.º 13
0
 private void AddScore(int value)
 {
     Debug.Log("this time the house LOSES!");
     AMS_ScoreController.increaseScore(value);
 }
Ejemplo n.º 14
0
    void Update()
    {
        if (playerIsActive)//to allow for killing the player controls
        {
            AMS_ScoreController.decreaseMultiplier();
            currentSpeed = runSpeed; //this is the default movement speed

            if (Input.GetKeyDown(grabResourceKey) && handy)
            {
                if (carriedObj == null)
                {
                    var dragables = FindObjectsOfType <DragScript>();
                    if (dragables.Length > 0)
                    {
                        var        closestRange    = Mathf.Infinity;
                        DragScript closestDragable = null;
                        foreach (DragScript dragable in dragables)
                        {
                            var dis = Vector3.Distance(transform.position, dragable.transform.position);
                            if (dis < closestRange && dis < grabRange)
                            {
                                closestRange = dis; closestDragable = dragable;
                            }
                        }//find nearest in grab range

                        if (closestDragable != null)
                        {
                            SetCarrying(closestDragable.gameObject);
                        }//there is one to grab
                        else
                        {
                        }       //none to grab
                    }//are there dragables in the scene
                }//wanting to pick up
                else
                {
                    SetCarrying(null);
                } //wanting to drop
            }     //player is trying to grab or drop maybe

            var gun = GetComponent <AMS_GunManagement>();
            if (gun != null)
            {
                if (gun.reloading || gun.IsFiring())
                {
                    currentSpeed = walkSpeed;
                }
                else
                {
                    currentSpeed = runSpeed;
                    PlayerSprint();
                }
            }
            else
            {
                Debug.Log("no gun found for movement calc");
            }

            if (charCont.isGrounded)
            {
                heading = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
                heading = heading.normalized * (currentSpeed * Time.deltaTime);
            }//only allow controls when player is grounded

            heading.y -= grav * Time.deltaTime;

            charCont.Move(heading);
        }
    }