Exemple #1
0
    // Use this for initialization
    void Start()
    {
        rigidbody = GetComponent <Rigidbody>();

        gameVars = globalvars.GetComponent <GameVars>();
        Debug.Log("testing console");
    }
Exemple #2
0
    // REFERENCED IN BUTTON CLICK UNITYEVENT
    public void GUI_Button_TryToLeavePort()
    {
        if (GameVars.Trade.CheckIfPlayerCanAffordToPayPortTaxes())
        {
            //MGV.controlsLocked = false;
            //Start Our time passage
            GameVars.playerShipVariables.PassTime(.25f, true);
            GameVars.justLeftPort = true;
            GameVars.playerShipVariables.ship.currency -= GameVars.currentPortTax;

            //Add a new route to the player journey log as a port exit
            GameVars.playerShipVariables.journey.AddRoute(new PlayerRoute(new Vector3(GameVars.playerShip.transform.position.x, GameVars.playerShip.transform.position.y, GameVars.playerShip.transform.position.z), Vector3.zero, GameVars.currentSettlement.settlementID, GameVars.currentSettlement.name, true, GameVars.playerShipVariables.ship.totalNumOfDaysTraveled), GameVars.playerShipVariables, GameVars.CaptainsLog);
            //We should also update the ghost trail with this route otherwise itp roduce an empty 0,0,0 position later
            GameVars.playerShipVariables.UpdatePlayerGhostRouteLineRenderer(GameVars.IS_NOT_NEW_GAME);

            //Turn off the coin image texture
            GameVars.menuControlsLock = false;

            GameVars.showSettlementGUI  = false;
            GameVars.runningMainGameGUI = true;

            Globals.UI.Hide <PortScreen>();
            Globals.UI.Show <Dashboard, DashboardViewModel>(new DashboardViewModel());
        }
        else          //Debug.Log ("Not Enough Drachma to Leave the Port!");
        {
            GameVars.ShowANotificationMessage("Not Enough Drachma to pay the port tax and leave!");
        }
    }
Exemple #3
0
 public override void OnOutAnimationFinished()
 {
     GameVars.BasePath   = Path.Combine(Environment.CurrentDirectory, "GameData") + "\\" + _mods[_selectedIndex] + "\\";
     MusicPlayer.modName = _mods[_selectedIndex];
     GameVars.DetectEmulationMode();
     GameEngine.Screen = new MainMenuScreen(null);
 }
Exemple #4
0
 public void GUI_HireANavigator()
 {
     //Do this if button pressed
     //Check to see if player has enough money to hire
     if (GameVars.playerShipVariables.ship.currency >= CostToHire)
     {
         //subtract the cost from the players currency
         GameVars.playerShipVariables.ship.currency -= (int)CostToHire;
         //change location of beacon
         Vector3 location = Vector3.zero;
         for (int x = 0; x < GameVars.settlement_masterList_parent.transform.childCount; x++)
         {
             if (GameVars.settlement_masterList_parent.transform.GetChild(x).GetComponent <script_settlement_functions>().thisSettlement.settlementID == City.settlementID)
             {
                 location = GameVars.settlement_masterList_parent.transform.GetChild(x).position;
             }
         }
         GameVars.MoveNavigatorBeacon(GameVars.navigatorBeacon, location);
         GameVars.playerShipVariables.ship.currentNavigatorTarget = City.settlementID;
         GameVars.ShowANotificationMessage("You hired a navigator to " + City.name + " for " + CostToHire + " drachma.");
         //If not enough money, then let the player know
     }
     else
     {
         GameVars.ShowANotificationMessage("You can't afford to hire a navigator to " + City.name + ".");
     }
 }
Exemple #5
0
    static Event CreateEvent(System.Type eventType, GameVars gameVars, Ship ship, ShipSpeedModifiers shipSpeedModifiers, Transform shipTransform, float aggregateCloutScore)
    {
        var result = System.Activator.CreateInstance(eventType) as Event;

        result.Init(gameVars, ship, shipSpeedModifiers, shipTransform, aggregateCloutScore);
        return(result);
    }
Exemple #6
0
    public SessionData()
    {
        //DataStore.InitData() has already been called at this point to load data
        difficulty               = Difficulty.NotSet;
        threatLevel              = addtlThreat = 0;
        allyRules                = AllyRules.Normal;
        optionalDeployment       = YesNo.No;
        allyThreatCost           = YesNo.No;
        selectedMissionExpansion = Expansion.Core;
        selectedMissionID        = "core1";
        selectedMissionName      = DataStore.missionCards["Core"][0].name;
        includeImperials         = true;
        includeMercs             = true;

        selectedDeploymentCards = new DeploymentCards[5];
        for (int i = 0; i < 5; i++)
        {
            selectedDeploymentCards[i] = new DeploymentCards();
        }
        selectedAlly = null;

        //ignore "Other" expansion enemy groups by default
        selectedDeploymentCards[3].cards.AddRange(DataStore.deploymentCards.cards.Where(x => x.expansion == "Other"));
        gameVars = new GameVars();
    }
Exemple #7
0
    void Awake()
    {
        essayTitles[0] = "Biology Essay";
        essayTitles[1] = "English Essay";

        textOutcomes[0] = "This is a text and i proud that i'm making it.";
        textOutcomes[1] = "MORE TEXT!";
        textOutcomes[2] = "EVEN MORE TEXT!";

        gameVars = GameObject.Find("GameManager").GetComponent <GameVars>();

        GameObject computer = GameObject.FindWithTag("Computer");

        text_UI = computer.transform.Find("Background/Screen/Text").GetComponent <Text>();
        title   = computer.transform.Find("Background/Screen/Title").GetComponent <Text>();

        if (howManyLetter == 0)
        {
            howManyLetter = 1;
        }
        story        = textOutcomes[gameVars.getHomeworkNum()];
        text_UI.text = "";
        int index = 0;

        title.text = essayTitles[Random.Range(0, 1)];
    }
Exemple #8
0
    }     // End Update()

    /**
     * Kills the unit
     */
    public void KillUnit()
    {
        // So the HP & DP will update again before this object is set inactive...
        Update();

        // Add the KIA sprite to the UnitButton
        GameObject KIA = Instantiate(Resources.Load <GameObject>("BlankSprite")) as GameObject;

        KIA.name                    = "KIASprite";
        KIA.transform.parent        = UnitButton.transform;
        KIA.transform.position      = UnitButton.transform.position;
        KIA.transform.localPosition = new Vector3(0, 35, 0);
        UISprite KIASprite = KIA.GetComponent <UISprite> ();

        KIASprite.spriteName = "KIA";
        KIASprite.depth      = 60;
        KIASprite.MakePixelPerfect();
        NGUITools.SetActive(KIA, true);

        // Gray out the BKG Sprites...
        GameObject.Find(UnitButton.name + "/UnitBKG").GetComponent <UISprite> ().color = new Color(.4f, .4f, .4f);
        GameObject.Find(UnitButton.name + "/HPLabel").GetComponent <UILabel>  ().color = new Color(.6f, .6f, .6f);
        GameObject.Find(UnitButton.name + "/DPLabel").GetComponent <UILabel>  ().color = new Color(.6f, .6f, .6f);


        // Notify the player that the unit has been killed...
        Console.Push("Unit " + GameVars.UCFirst(Type) + " has been killed!");

        // Set alive to false
        Alive = false;

        // Deactivate the game object...
        NGUITools.SetActive(gameObject, false);
    }     // End KillUnit()
Exemple #9
0
    // Use this for initialization
    void Start()
    {
        gameRules      = GameObject.Find("GameRules");
        gameVarsScript = gameRules.GetComponent <GameVars>();

        Player       = GameObject.FindWithTag("Player");
        playerScript = Player.GetComponent <PlayerBehavior>();
    }
Exemple #10
0
    // Use this for initialization
    void Start()
    {
        _cars = new List <GameObject>();

        _gameVars = GlobalVars.GetComponent <GameVars>();

        LaunchCars();
    }
Exemple #11
0
 public void Init(GameVars gameVars, Ship ship, ShipSpeedModifiers shipSpeedModifiers, Transform shipTransform, float aggregateCloutScore)
 {
     this.gameVars            = gameVars;
     this.ship                = ship;
     this.shipSpeedModifiers  = shipSpeedModifiers;
     this.shipTransform       = shipTransform;
     this.aggregateCloutScore = aggregateCloutScore;
 }
Exemple #12
0
 private void Start()
 {
     image     = GameObject.Find("Options").GetComponent <Image>();
     _gameVars = GameObject.Find("GameController").GetComponent <GameVars>();
     if (_gameVars.withSound == 0)
     {
         image.sprite = muted;
     }
 }
    void Start()
    {
        //Find the matching resource of this gameObject's label, and add the description here
        GameVars = Globals.GameVars;
        bgSprite = gameObject.transform.parent.GetChild(0);        //bg sprite should always be the first index

        resourceName = GameVars.masterResourceList[resourceID].name;
        message      = GameVars.masterResourceList[resourceID].description;

        message = resourceName + " : " + message;

        //Figure out needed pop up dimensions. Each Line of text should be no more than 40 chars
        //I went overboard with this--GUI.Labels handle word-wrapping so I don't think I need the string list
        //--but this is still useful in getting the number of 'rows' needed for the word wrap
        if (message.Length < 40)
        {
            width  = 400f;
            height = 25f + 10f;
            bgSprite.localScale = Vector3.one;
        }
        else
        {
            //This will get complicated: We need to get the first 40 characters--that ends in a ' ' (space)
            //If the 40th character is not a space, then count backwards until we find one and use that index for the first slice

            for (int i = 0; i < message.Length; i += 100)
            {
                int indexModifier = 0;                //this will be our default
                int newEndIndex   = i + 100;          //This will be our default
                //First check if the character in this position is a space ' '
                if (message[i] != ' ')
                {
                    //If it is, then we need to search for the first space counting back from index 40
                    for (int a = 100; a >= 0; a--)
                    {
                        if (message[a] == ' ')
                        {
                            //Figure out the difference of indices we skipped
                            indexModifier = newEndIndex - a;
                            //Set our new split end position to 'a' index
                            newEndIndex = a;
                        }
                    }
                }
                allLines.Add(message.Substring(i, Mathf.Min(newEndIndex, message.Length - i)));
                //Finally apply our index Modifer--essentially we rest 'i' back to the index we found the space
                //	--before it gets incremented another 40 characters
                i -= indexModifier;
            }
            width  = 400f;
            height = (25f * allLines.Count) + 10f;
            bgSprite.localScale += new Vector3(0, allLines.Count, 0);
        }
    }
Exemple #14
0
        /// <summary>
        /// Returns value with every escaped character and variable. If you do not want to replace those use <see cref="Plain()"/>.
        /// </summary>
        /// <param name="gv">Object storing game variables used inside those strings</param>
        /// <returns>string that has parsed value of Sentence</returns>
        public string GetValue(GameVars gv)
        {
            string place = "Sentence#GetValue(GameVars)";           // set place for errors

            if (String.IsNullOrWhiteSpace(value))                   // check if Sentence is assigned
            {
                new Debug(place, $"You try to read from unassigned Sentence '{name}'! Returned null!", Debug.Importance.ERROR);
                return(null);
            }
            // reassign variable to not change the original
            string r = value;

            if (gv == null)                                                        // if GameVars not present
            {
                gv = new GameVars( );                                              // create new one for escaping $$, $<$> and $<endl>
            }
            r = Regex.Replace(r, @".(?<=\$)\$", "$<$>");                           // change each $$ to $<$>
            r = Regex.Replace(r, @".(?<=\$)(?<s>""|'|`)", "${s}");                 // escape each $", $', $`
            foreach (Match m in Regex.Matches(r, @"(?<whole>\$<(?<var>.*?)>)"))    // foreach $<var>
            {
                string vr = "";                                                    // new value
                if (m.Groups["var"].Value == "$")                                  // if it is $<$>
                {
                    r = r.Substring(0, m.Index) + "$" + r.Substring(m.Index + 4);  // replace it properely
                    continue;                                                      // go to next one
                }
                if (m.Groups["var"].Value.ElementAt(0) == '.')                     // if its backreferenece to same language
                {
                    vr = l[m.Groups["var"].Value.Substring(1)].GetValue(gv) ?? ""; // get value from language as changing
                }
                else                                                               // if its reference to GameVars
                {
                    vr = gv[m.Groups["var"].Value] ?? "";                          // get value from GameVars as changing
                }
                // If value returned from language/GameVars is not empty or null ( is present )
                if (!String.IsNullOrWhiteSpace(vr))
                {
                    r = Regex.Replace(r, "\\" + m.Groups["whole"].Value, vr);                       // replace $<var> with value of var
                }
                else
                {
                    if (m.Groups["var"].Value.ElementAt(0) == '.')                      // if its backreferenece to same language
                    {
                        new Debug(place, $"Language({l.NAME}:{l.ID}) does not have field named '{m.Groups["var"].Value.Substring(1)}'", Debug.Importance.ERROR);
                    }
                    else                     // if its reference to GameVars
                    {
                        new Debug(place, $"Given GameVars does not have field named '{m.Groups["var"].Value}'", Debug.Importance.ERROR);
                    }
                }
            }
            // return escaped string
            return(r ?? null);
        }
 public void GUI_BuyNewShip()
 {
     if (GameVars.playerShipVariables.ship.currency > costToBuyUpgrade)
     {
         GameVars.UpgradeShip(costToBuyUpgrade);
     }
     else
     {
         GameVars.ShowANotificationMessage("Earn more drachma through trade to upgrade your ship!");
     }
 }
Exemple #16
0
    public void GUI_TakeOutLoan()
    {
        var loanAmount = NewLoan.amount;
        var loan       = NewLoan;

        GameVars.playerShipVariables.ship.currentLoan = loan;
        GameVars.playerShipVariables.ship.currency   += loanAmount;
        GameVars.ShowANotificationMessage("You took out a loan of " + loanAmount + " drachma! Remember to pay it back in due time!");

        NotifyAny();
    }
Exemple #17
0
    private void Start()
    {
        _animator = GetComponent <Animator>();
        var interactables = CCanvas.transform.Find("Interactables");
        var fixedNumbers  = interactables.Find("FixedNumbers");

        _customPrice = fixedNumbers.GetComponent <CustomPrice>();
        _gameVars    = GameObject.Find("GameController").GetComponent <GameVars>();
        var  randomClip       = Random.Range(0, clipsName.Count);
        bool monkeyLiberated  = false;
        bool dogLiberated     = false;
        bool ghostLiberated   = false;
        bool fishLiberated    = false;
        bool godlingLiberated = false;

        if (clipsName[randomClip] == "Monkey" && _gameVars.monkeysCollected >= _customPrice.monkeyPrice)
        {
            monkeyLiberated = true;
            randomClip     += 1;
        }

        if (clipsName[randomClip] == "Dog" && _gameVars.dogsCollected >= _customPrice.dogPrice)
        {
            dogLiberated = true;
            randomClip  += 1;
        }

        if (clipsName[randomClip] == "Ghost" && _gameVars.ghostCollected >= _customPrice.ghostPrice)
        {
            ghostLiberated = true;
            randomClip    += 1;
        }

        if (clipsName[randomClip] == "Fish" && _gameVars.fishCollected >= _customPrice.fishPrice)
        {
            fishLiberated = true;
            randomClip   += 1;
        }

        if (clipsName[randomClip] == "Godling" && _gameVars.godlingsCollected >= _customPrice.godlingPrice)
        {
            godlingLiberated = true;
            randomClip       = 0;
        }

        if (monkeyLiberated && dogLiberated && ghostLiberated && fishLiberated && godlingLiberated)
        {
            Destroy(gameObject);
        }

        _animator.Play(clipsName[randomClip]);
        petType = clipsName[randomClip];
    }
Exemple #18
0
 private void Start()
 {
     _gameVars    = GameObject.Find("GameController").GetComponent <GameVars>();
     _customPrice = transform.Find("FixedNumbers").GetComponent <CustomPrice>();
     monkey       = transform.Find("Monkey").GetComponent <Image>();
     dog          = transform.Find("Dog").GetComponent <Image>();
     fish         = transform.Find("Fish").GetComponent <Image>();
     ghost        = transform.Find("Ghost").GetComponent <Image>();
     godling      = transform.Find("Godling").GetComponent <Image>();
     CheckLiberated();
     CheckStartSelected();
 }
Exemple #19
0
 public void GUI_BuyHint()
 {
     if (GameVars.playerShipVariables.ship.currency < CostForHint)
     {
         GameVars.ShowANotificationMessage("Not enough money to buy this information!");
     }
     else
     {
         GameVars.playerShipVariables.ship.currency -= CostForHint;
         GameVars.ShowANotificationMessage(GetInfoOnNetworkedSettlementResource(City.cargo[UnityEngine.Random.Range(0, City.cargo.Length)]));
     }
 }
Exemple #20
0
 public void ChangeSoundState()
 {
     _gameVars = GameObject.Find("GameController").GetComponent <GameVars>();
     if (_gameVars.withSound == 1)
     {
         _gameVars.withSound = 0;
     }
     else
     {
         _gameVars.withSound = 1;
     }
     PlayerPrefs.SetInt("Sound", _gameVars.withSound);
 }
Exemple #21
0
 void Start()
 {
     _gameVars    = GameObject.Find("GameController").GetComponent <GameVars>();
     _audioSource = GetComponent <AudioSource>();
     if (_gameVars.withSound == 1)
     {
         _audioSource.volume = 1;
     }
     else
     {
         _audioSource.volume = 0;
     }
 }
Exemple #22
0
 private void Start()
 {
     _gameVars = GameObject.Find("GameController").GetComponent <GameVars>();
     _animator = GetComponent <Animator>();
     _animator.Play(_gameVars.selectedPet);
     if (_gameVars.selectedPet == "Fish")
     {
         transform.Find("Helmet").gameObject.SetActive(true);
     }
     if (_gameVars.selectedPet != "Monkey" && _gameVars.selectedPet != "Dog" && _gameVars.selectedPet != "Fish" && _gameVars.selectedPet != "Ghost" && _gameVars.selectedPet != "Godling")
     {
         gameObject.SetActive(false);
     }
 }
Exemple #23
0
 private void Start()
 {
     _gvars        = GameObject.Find("GameController").GetComponent <GameVars>();
     monkeyT       = transform.Find("T_Monkey").GetComponent <TextMeshProUGUI>();
     ghostT        = transform.Find("T_Ghost").GetComponent <TextMeshProUGUI>();
     godlingT      = transform.Find("T_Godling").GetComponent <TextMeshProUGUI>();
     dogT          = transform.Find("T_Dog").GetComponent <TextMeshProUGUI>();
     fishT         = transform.Find("T_Fish").GetComponent <TextMeshProUGUI>();
     monkeyT.text  = _gvars.monkeysCollected.ToString();
     ghostT.text   = _gvars.ghostCollected.ToString();
     fishT.text    = _gvars.fishCollected.ToString();
     dogT.text     = _gvars.dogsCollected.ToString();
     godlingT.text = _gvars.godlingsCollected.ToString();
 }
    public void GUI_RepairShipByAllHP()
    {
        if (Mathf.CeilToInt(GameVars.playerShipVariables.ship.health) >= 100)
        {
            GameVars.ShowANotificationMessage("Your ship is already fully repaired");
        }
        else
        {
            GameVars.playerShipVariables.ship.currency -= (int)(costToRepair * Mathf.CeilToInt(100 - GameVars.playerShipVariables.ship.health));
            GameVars.playerShipVariables.ship.health    = 100f;
        }

        NotifyAny();
    }
        public static void BuildLevel(string levelPath, ref GameVars gv)
        {
            //List<string> levelData = new List<string>();

            StreamReader sr = new StreamReader(levelPath);
            int row = 0;

            gv.effects = new List<deathcave_logic.gameObjects.BaseGameObject>();
            gv.enemies = new List<deathcave_logic.gameObjects.BaseGameObject>();
            gv.obstacles = new List<deathcave_logic.gameObjects.BaseGameObject>();
            gv.powerups = new List<deathcave_logic.gameObjects.BaseGameObject>();

            while (!sr.EndOfStream)
            {
                string lineBuffer = sr.ReadLine().Substring(0, 25);
                int col = 0;
                foreach (char c in lineBuffer)
                {
                    // game obstacles
                    if (c == '#')
                        gv.obstacles.Add(new gameObjects.ObstacleWall(col * 32, row * 32));

                    // game enemies
                    if (c == 'V')
                        gv.enemies.Add(new gameObjects.EnemyDropper(col * 32, row * 32));
                    if (c == '$')
                        gv.enemies.Add(new gameObjects.EnemySwooper(col * 32, row * 32));
                    if (c == 'X')
                        gv.enemies.Add(new gameObjects.EnemyShooter(col * 32, row * 32));

                    // powerups
                    if (c == '"')
                        gv.powerups.Add(new gameObjects.PowerUpShield(col * 32, row * 32));
                    if (c == '%')
                        gv.powerups.Add(new gameObjects.PowerUpExtraLife(col * 32, row * 32));

                    if (c == '1')
                    {
                        gv.ship.SetPosition(col * 32, row * 32);

                        gv.levelStartPosition = row * 32;
                    }

                    col = col + 1;
                }

                row = row + 1;
            }
        }
Exemple #26
0
 private void Start()
 {
     isHoldingNumber         = 999; //Just for check true without bool
     thisRigidBody           = GetComponent <Rigidbody2D>();
     holdingRigidBody        = thisRigidBody;
     _ropeGenerator          = GameObject.Find("RopeGenerator").GetComponent <RopeGenerator>();
     cameraXDis              = Camera.main.orthographicSize / 9 * 16;
     _playerAnimations       = transform.Find("PlayerSprite").GetComponent <PlayerAnimations>();
     _gameController         = GameObject.Find("GameController").GetComponent <GameController>();
     thisRigidBody.velocity += Vector2.right * initialVelocity;
     canvasInGame            = GameObject.Find("CanvasInGame");
     _gameVars       = GameObject.Find("GameController").GetComponent <GameVars>();
     initVelocityMod = velocityMod;
     _soundEmmiter   = Camera.main.transform.Find("Sounds").GetComponent <SoundEmmiter>();
 }
Exemple #27
0
    public void ChangeSprite()
    {
        _gameVars = GameObject.Find("GameController").GetComponent <GameVars>();
        if (_gameVars.withSound == 0)
        {
            image.sprite = muted;
            StopMusic();
        }

        if (1 == _gameVars.withSound)
        {
            image.sprite = unMuted;
            StartMusic();
        }
    }
    public void GUI_RepairShipByOneHP()
    {
        GameVars.playerShipVariables.ship.health += 1f;
        //make sure the hp can't go above 100
        if (GameVars.playerShipVariables.ship.health > 100)
        {
            GameVars.playerShipVariables.ship.health = 100;
            GameVars.ShowANotificationMessage("Your ship is already fully repaired");
        }
        else
        {
            GameVars.playerShipVariables.ship.currency -= costToRepair;
        }

        NotifyAny();
    }
 static void InitializeRooms()
 {
     for (int i = 1; i <= 50; ++i)
     {
         Color           floorColor = new Color(Random.Range(128f, 255f), Random.Range(128f, 255f), Random.Range(128f, 255f));
         AddonParameters parameters = new AddonParameters
         {
             minArea          = GameVars.GetPlatformArea(i),
             primarySizeMin   = GameVars.GetSpacePlatformMinSize(i) + 2,
             primarySizeMax   = GameVars.GetSpacePlatformMaxSize(i) + 2,
             secondarySizeMin = GameVars.GetSpacePlatformMinSize(i),
             secondarySizeMax = GameVars.GetSpacePlatformMaxSize(i)
         };
         Bounds3Int[] bounds = AddonGen.GenerateAddon(parameters);
         SpacePlatform.Create(bounds, floorColor);
     }
 }
    public RepairsViewModel()
    {
        //We need to do a clout check as well as a network checks
        int baseModifier = Mathf.CeilToInt(2 - GameVars.GetOverallCloutModifier(GameVars.currentSettlement.settlementID));

        if (GameVars.Network.CheckIfCityIDIsPartOfNetwork(GameVars.currentSettlement.settlementID))
        {
            costToRepair = Mathf.CeilToInt(GameVars.currentSettlement.tax_network * baseModifier * 1);
        }
        else
        {
            costToRepair = Mathf.CeilToInt(GameVars.currentSettlement.tax_neutral * baseModifier * 1);
        }

        shipHealth = new BoundModel <float>(GameVars.playerShipVariables.ship, nameof(GameVars.playerShipVariables.ship.health));
        shipLevel  = new BoundModel <int>(GameVars.playerShipVariables.ship, nameof(GameVars.playerShipVariables.ship.upgradeLevel));
    }
Exemple #31
0
    public void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "EndMap")
        {
            //Debug.Log("out of bounds");
            GameVars.ResetVars();
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }

        if (col.tag == "Food")
        {
            //Debug.Log("crash");
            audioCoin.Play();
            GameVars.points += 1;
            Destroy(col.gameObject);
        }

        if (col.tag == "case")
        {
            //Debug.Log("Crash case");
            audioCase.Play();
            rb.gravityScale    += GetPlayerGravity(sceneName);
            GameVars.foodForce -= 0.15f;
            Destroy(col.gameObject);
        }

        if (col.tag == "Rotten Food")
        {
            //Debug.Log("Rotten");
            audioRotten.Play();
            rb.gravityScale       += AddWeight(sceneName);
            GameVars.rottenPoints += 1;
            Destroy(col.gameObject);
        }

        if (col.tag == "Plane")
        {
            GameVars.ResetVars();
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }

        // se destruye todo lo que toca jugador
        // considerar ponerlo en condiciones individuales
        //Destroy(col.gameObject);
    }
Exemple #32
0
 // Singleton Vars.
 void Awake()
 {
     if (vars == null) {
         DontDestroyOnLoad (gameObject);
         vars = this;
     } else if (vars != this) {
         Destroy(gameObject);
     }
 }