Beispiel #1
0
 protected new void Start()
 {
     base.Start();
     distFollow     = 0.1f;
     moveTowards    = true;
     emmitter       = GetComponentInParent <MinionEmmitter>();
     playerScript   = player.GetComponent <Player>();
     playerRB       = player.GetComponent <Rigidbody2D>();
     playerRenderer = player.GetComponent <Renderer>();
     faca           = GameManager.instance.gameObject.transform.Find("Faca").gameObject.GetComponent <AttackObject>();
     bastao         = GameManager.instance.gameObject.transform.Find("Bastao").gameObject.GetComponent <AttackObject>();
     tampa          = GameManager.instance.gameObject.transform.Find("Tampa").gameObject.GetComponent <ProtectionObject>();
     escudo         = GameManager.instance.gameObject.transform.Find("Escudo").gameObject.GetComponent <ProtectionObject>();
     pedra          = GameManager.instance.gameObject.transform.Find("Pedra").gameObject.GetComponent <FarAttackObject>();
     papel          = GameManager.instance.gameObject.transform.Find("Papel").gameObject.GetComponent <FarAttackMiniGameObject>();
 }
Beispiel #2
0
 void OnEnable()
 {
     //ps = GetComponent<ParticleSystem>();
     tampa  = GameManager.instance.gameObject.transform.Find("Tampa").gameObject.GetComponent <ProtectionObject>();
     escudo = GameManager.instance.gameObject.transform.Find("Escudo").gameObject.GetComponent <ProtectionObject>();
 }
Beispiel #3
0
        // CRIAÇÃO JOGO
        public void Awake()
        {
            if (instance == null)
            {
                DontDestroyOnLoad(gameObject);
                instance = this;

                currentSceneName  = SceneManager.GetActiveScene().name;
                previousSceneName = currentSceneName;

                hud = GameObject.Find("HUDCanvas").gameObject;

                levelImage = hud.transform.Find("LevelImage").gameObject;
                levelText  = levelImage.transform.Find("LevelText").GetComponent <Text>();

                tampaProtectionObject  = tampa.GetComponent <ProtectionObject>();
                escudoProtectionObject = escudo.GetComponent <ProtectionObject>();

                player         = GetComponent <Player>();
                rendererPlayer = GetComponent <Renderer>();
                colorCamera    = GameObject.Find("MainCamera").GetComponent <UnityStandardAssets.ImageEffects.ColorCorrectionLookup>();

                currentMission = PlayerPrefs.GetInt("Mission");
                // Salva o jogo somente quando jogar através do New Game ou Continue
                if (currentMission == -1 || currentMission == 0)
                {
                    PlayerPrefs.SetInt("SaveGame", 0);
                }
                else
                {
                    PlayerPrefs.SetInt("SaveGame", 1);
                }

                if (currentMission == -1)
                {
                    currentMission = 1;

                    Inventory.SetInventory(null);
                    tampaProtectionObject.life  = 80;
                    escudoProtectionObject.life = 120;

                    Book.pageQuantity = 0;
                    sideQuests        = 0;

                    pathBird = 0;
                    pathCat  = 0;

                    mission1AssustaGato   = false;
                    mission2ContestaMae   = false;
                    mission4QuebraSozinho = false;
                    mission10BurnCorredor = false;

                    SetMission(currentMission);
                    SaveGame(1, -1);
                }
                else
                {
                    LoadGame(currentMission);
                }

                rpgTalk.OnChoiceMade += OnChoiceMade;
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }
        }