Exemplo n.º 1
0
    public virtual void Start()
    {
        timeBetweenAttacks = 1 * Time.deltaTime;
        count = 1 * Time.deltaTime;

        actualColor = 0;
        health      = 3;


        foreach (SpriteRenderer sprite in modifiableColor)
        {
            sprite.color = colorStart;
        }

        SpawnNewShield("Shield_UP");

        managerObject       = GameObject.FindGameObjectWithTag("SceneManager");
        managerGetVariables = managerObject.GetComponent <ManagerScene>();

        spaceshipUsed      = managerGetVariables.GetComponent <ManagerScene>().typeOfSpaceshipBeingUsed;
        numberProjectiles  = managerGetVariables.GetComponent <ManagerScene>().numProjectiles;
        delayBetweenAttack = managerGetVariables.GetComponent <ManagerScene>().delayBetweenAttacks;

        colliderPlayer = GetComponent <CapsuleCollider2D>();

        playerAnimator = GetComponentInChildren <Animator>();
    }
Exemplo n.º 2
0
    public virtual void Die()
    {
        dead = true;

        if (OnDeath != null)
        {
            OnDeath();
        }


        GameObject canvasGameOver = managerGetVariables.canvasGameOver;

        canvasGameOver.SetActive(true);

        sceneManager = GameObject.FindGameObjectWithTag("SceneManager");

        ManagerScene manageSceneVariableChanger = sceneManager.GetComponent <ManagerScene>();

        manageSceneVariableChanger.isPlayerAlive = false;



        TrashMan.despawn(gameObject);
        dead   = false;
        health = 3;
    }
Exemplo n.º 3
0
    public static void LoadScene(SceneEnum state, string sceneName = "")
    {
        if (string.IsNullOrEmpty(sceneName) || sceneName.CompareTo("") == 0)
        {
            sceneName = ManagerScene.GetSceneName(state);
        }

        if (state == enteringScene)
        {
            //防止卡死,当前场景 就是目标场景 不需要切换"
            Debug.LogError("SceneState : " + state + "     enteringScene : " + enteringScene);
            return;
        }

        enteringScene = state;

        // 开始加载场景
        StartGoToScene(state);

        //AsyncOperation asyncOperation = null;
        //AssetPool.Instance.Scene.LoadScene(sceneName, out asyncOperation);
        //Game.Instance.StartCoroutine(WaitLoadScene(state, asyncOperation));

        // LoadScene(string sceneName, LoadCallBackHandler CallBack)
        AssetPool.Instance.Scene.LoadScene(sceneName, LoadSceneCallBack);
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Awake()
    {
        //Pegar os objetos do GM, e setar as skills e o ManagerScene
        GM = GameObject.FindGameObjectWithTag("GameController");
        skills = GM.GetComponent<Skills>();
        gmManagerScene = GM.GetComponent<ManagerScene>();
        gmManagerScene.GetScenesModeGame();

        //Verificar se o modo de jogo é survival
        if (gmManagerScene.gameMode == "Survival")
        {
            print("Entrou no if");
            wavesDetailsSurvival = GameObject.FindGameObjectWithTag("Canvas").GetComponent<WavesDetailsSurvival>();
        }

        // anim = GetComponent<Animator>();
        // enemyAudio = GetComponent<AudioSource>();
        capsuleCollider = GetComponent<CapsuleCollider>();
        damageGO.SetActive(false);
        currentHealth = startingHealth;

        //Achar o PlayerExperience
        if (GameObject.FindGameObjectWithTag("Player"))
        {
            player = GameObject.FindGameObjectWithTag("Player");
            playerExperience = player.GetComponent<PlayerExperience>();
        }
    }
Exemplo n.º 5
0
 void Awake()
 {
     typeIdList    = new List <NetworkHash128>();
     spawnManager  = new SpawnManager();
     managerScene  = (ManagerScene)GameObject.FindObjectOfType(typeof(ManagerScene));
     serverManager = (StrategyServerManager)managerScene.NetworkManager;
 }
Exemplo n.º 6
0
    void FixedUpdate()
    {
        count += 1 * Time.deltaTime;
        //Parte que procura a câmera e pega o componente script CameraShake
        try
        {
            GameObject camSearch = GameObject.FindGameObjectWithTag("MainCamera");
            cam = camSearch.GetComponent <CameraShake>();

            managerScene        = GameObject.FindGameObjectWithTag("SceneManager");
            sceneManagerUpdated = managerScene.GetComponent <ManagerScene>();
        }
        catch (NullReferenceException)
        {
            Debug.Log("não encontrado");
        }

        //Movimentação do projétil
        float moveDistance = speed * Time.deltaTime;

        transform.Translate(Vector2.down * moveDistance);

        if (count > 5)
        {
            count = 0;
            TrashMan.despawn(gameObject);
        }
    }
Exemplo n.º 7
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
 // Use this for initialization
 void Start()
 {
     CreateResolution();
     managerScene = (ManagerScene)FindObjectOfType(typeof(ManagerScene));
     if (managerScene != null)
     {
         Settings = managerScene.Settings;
         LoadUI();
     }
 }
Exemplo n.º 9
0
    void FixedUpdate()
    {
        //Parte que procura a câmera e pega o componente script CameraShake
        GameObject camSearch = GameObject.FindGameObjectWithTag("MainCamera");

        cam = camSearch.GetComponent <CameraShake>();

        managerScene        = GameObject.FindGameObjectWithTag("SceneManager");
        sceneManagerUpdated = managerScene.GetComponent <ManagerScene>();
    }
Exemplo n.º 10
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
 }
Exemplo n.º 11
0
    // Use this for initialization

    private void Awake()
    {
        if (GetManagerScene == null)
        {
            GetManagerScene = this;
        }
        else if (GetManagerScene != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
    }
Exemplo n.º 12
0
 private void Awake()
 {
     managerScene = GameObject.FindGameObjectWithTag("GameController").GetComponent <ManagerScene>();
     managerScene.GetScenesModeGame();
     gameOver      = GetComponent <GameOverManager>();
     levelComplete = GetComponent <LevelCompleteManager>();
     player        = GameObject.FindGameObjectWithTag("Player");
     playerHealth  = player.GetComponent <PlayerHealth>();
     playerMana    = player.GetComponent <Mana>();
     gm            = GameObject.FindGameObjectWithTag("GameController");
     skills        = gm.GetComponent <Skills>();
 }
Exemplo n.º 13
0
    // Use this for initialization
    void Awake()
    {
        //Obtém o managerScene para poder obter os modos de jogo
        managerScene = GameObject.FindGameObjectWithTag("GameController").GetComponent <ManagerScene>();
        managerScene.GetScenesModeGame();

        playerPotions = GameObject.FindGameObjectWithTag("Canvas").GetComponent <PotionsScript>();
        //    anim = GetComponent<Animator>();
        //    playerAudio = GetComponent<AudioSource>();
        player         = GetComponent <PlayerController>();
        playerShooting = GetComponentInChildren <PlayerShooting>();
    }
Exemplo n.º 14
0
    private void Awake()
    {
        //Obtém o managerScene para poder obter os modos de jogo
        managerScene = GameObject.FindGameObjectWithTag("GameController").GetComponent <ManagerScene>();
        managerScene.GetScenesModeGame();


        gunParticle = GetComponent <ParticleSystem>();
        // gunLine = GetComponent<LineRenderer>();
        //  gunAudio = GetComponent<AudioSource>();
        gunLight     = GetComponent <Light>();
        playerHealth = GetComponentInParent <PlayerHealth>();
    }
Exemplo n.º 15
0
    void FixedUpdate()
    {
        //Parte que procura a câmera e pega o componente script CameraShake
        try
        {
            GameObject camSearch = GameObject.FindGameObjectWithTag("MainCamera");
            cam = camSearch.GetComponent <CameraShake>();

            managerScene        = GameObject.FindGameObjectWithTag("SceneManager");
            sceneManagerUpdated = managerScene.GetComponent <ManagerScene>();
        }
        catch (NullReferenceException)
        {
            Debug.Log("Não encontrado");
        }
    }
Exemplo n.º 16
0
    void OnTriggerExit(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            u = other.gameObject.GetComponent <BasicCharControl>().player_id;
            Person.playersDeath[cont] = other.gameObject;
            Destroy(other.gameObject);
            cont++;
        }

        if (cont == Person.modo - 1)
        {
            // this.Quem();
            ManagerScene manager = new ManagerScene();
            manager.Vitoria();
            // DontDestroyOnLoad();
        }
    }
Exemplo n.º 17
0
    // Use this for initialization
    void Start()
    {
        playerCtrls  = new List <PlayerController>();
        managerScene = (ManagerScene)GameObject.FindObjectOfType(typeof(ManagerScene));
        LoadNetwork();

        if (Solo == false)
        {
            LoadSpawner();
            if (!networkManager.IsServer)
            {
                NetworkConnection connection = ((StrategyClientManager)networkManager).GetConnection();
                Debug.Log("Ready : " + ClientScene.Ready(connection));
                Debug.Log("Add Player : " + ClientScene.AddPlayer(connection, 1));
            }
        }

        managerScene.LoadScene("PauseMenu", LoadSceneMode.Additive);
    }
    void Update()
    {
        //Parte que procura a câmera e pega o componente script CameraShake
        GameObject camSearch = GameObject.FindGameObjectWithTag("MainCamera");

        cam = camSearch.GetComponent <CameraShake>();

        managerScene        = GameObject.FindGameObjectWithTag("SceneManager");
        sceneManagerUpdated = managerScene.GetComponent <ManagerScene>();

        //Movimentação do projétil
        float moveDistance = speed * Time.deltaTime;

        transform.Translate(Vector2.down * moveDistance);
        lifetime += 1 * Time.deltaTime;

        if (lifetime > 5)
        {
            TrashMan.despawn(gameObject);
        }
    }
Exemplo n.º 19
0
    public void TakeDamage(float damage)
    {
        health   -= damage;
        auxHealth = health;

        if (health <= 0 && !dead)
        {
            ManagerScene updateScore = sceneManagerObject.GetComponent <ManagerScene>();

            updateScore.score += 100;

            animatorEnemy.SetTrigger("death");


            if (animatorEnemy.isInitialized)
            {
                StartCoroutine("destruction");

                TrashMan.spawn("VFX_DEATH_BOSS", transform.position, transform.rotation);
            }

            Die();
        }
    }
Exemplo n.º 20
0
 private void OnLoadedGlobalPrefabs()
 {
     // 全部加载完成
     ManagerScene.LoadScene(SceneEnum.Login);
 }
Exemplo n.º 21
0
    public void Awake()
    {
        escenasMng = GetComponent <ManagerScene>();

        escenasMng.MainMenu();
    }
 private void Awake()
 {
     Instance = this;
 }
Exemplo n.º 23
0
    void Update()
    {
        startTime -= Time.deltaTime;

        if (startTime >= 0.0)
        {
            if (startTime <= FIRST_DROP + 10 && dropped1 == false)
            {
                if (startTime >= FIRST_DROP + 5.00)
                {
                    timerText.color = Color.yellow;
                }
                else if (startTime >= FIRST_DROP)
                {
                    timerText.color = Color.red;
                }
                else
                {
                    earthDrop = GameObject.Find("FragDisc_externo");
                    earthDrop.GetComponent <MeshCollider>().convex   = true;
                    earthDrop.GetComponent <Rigidbody>().isKinematic = false;
                    earthDrop.GetComponent <Rigidbody>().useGravity  = true;
                    dropped1        = true;
                    timerText.color = Color.white;
                }
            }

            if (startTime <= SECOND_DROP + 10 && dropped2 == false)
            {
                if (startTime >= SECOND_DROP + 5.00)
                {
                    timerText.color = Color.yellow;
                }
                else if (startTime >= SECOND_DROP)
                {
                    timerText.color = Color.red;
                }
                else
                {
                    earthDrop = GameObject.Find("FragDisc_meio");
                    earthDrop.GetComponent <MeshCollider>().convex   = true;
                    earthDrop.GetComponent <Rigidbody>().isKinematic = false;
                    earthDrop.GetComponent <Rigidbody>().useGravity  = true;
                    dropped2        = true;
                    timerText.color = Color.yellow;
                }
            }

            if (dropped1 && dropped2)
            {
                if (startTime <= 10)
                {
                    timerText.color = Color.red;
                }
            }

            int minutes = (int)startTime / 60;
            int seconds = (int)startTime % 60;

            string min, sec;

            if (minutes < 10)
            {
                min = "0" + minutes.ToString();
            }
            else
            {
                min = minutes.ToString();
            }

            if (seconds < 10)
            {
                sec = "0" + seconds.ToString();
            }
            else
            {
                sec = seconds.ToString();
            }

            timerText.text = min + ":" + sec;
        }
        else
        {
            timerText.text = "00:00";
            earthDrop      = GameObject.Find("FragDisc_interno");
            earthDrop.GetComponent <MeshCollider>().convex   = true;
            earthDrop.GetComponent <Rigidbody>().isKinematic = false;
            earthDrop.GetComponent <Rigidbody>().useGravity  = true;

            if (startTime <= -1)
            {
                ManagerScene manager = new ManagerScene();
                manager.MenuGame();
            }
        }
    }
Exemplo n.º 24
0
 private void Awake()
 {
     managerScene = GameObject.FindGameObjectWithTag("GameController").GetComponent <ManagerScene>();
     managerScene.GetScenesModeGame();
 }
Exemplo n.º 25
0
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(this);
     managerScene = (ManagerScene)GameObject.FindObjectOfType(typeof(ManagerScene));
 }
Exemplo n.º 26
0
 private void OnLoginOk(byte[] data)
 {
     ManagerScene.LoadScene(SceneEnum.Battle);
     Show(false);
 }
Exemplo n.º 27
0
    public virtual void Update()
    {
        enemy               = GameObject.FindWithTag("Enemy");
        managerObject       = GameObject.FindGameObjectWithTag("SceneManager");
        managerGetVariables = managerObject.GetComponent <ManagerScene>();
        move = false;


        try
        {
            target = enemy.GetComponent <LivingEntity>();
        }
        catch (NullReferenceException)
        {
            Debug.Log("Inimigo Não encontrado!");
        }

        timeBetweenAttacks += 1 * Time.deltaTime;



#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_EDITOR
        if (Input.GetMouseButtonDown(0))
        {
            /*float timeDelta = Time.time - lastClickTime;
             *
             * if (timeDelta < doubleClickTime)
             * {
             *      Debug.Log("double click" + timeDelta);
             *
             *      changeColorPlayer(actualColor);
             *      changeColorShield(actualColor);
             *
             *      lastClickTime = 0;
             * }
             * else
             * {
             *      lastClickTime = Time.time;
             * }*/

            if (canChangeColor == true)
            {
                changeColorPlayer(actualColor);
                changeColorShield(actualColor);
                canChangeColor = false;
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            canChangeColor = true;
            playerAnimator.SetBool("isAttacking", false);
        }

        if (Input.GetMouseButton(0))
        {
            if (timeBetweenAttacks > delayBetweenAttack)
            {
                Attack("Projectile_Player", numberProjectiles);
                count = 0;
                timeBetweenAttacks = 0;
            }

            targetMove = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,
                                                                    Input.mousePosition.y, Camera.main.nearClipPlane));
            targetMove.z = 0;

            if (move == false)
            {
                move = true;
            }
        }
        if (move == true && !dead)
        {
            transform.position = Vector3.MoveTowards(transform.position, targetMove, speed * Time.deltaTime);
        }
#elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8 || UNITY_IPHONE
        if (timeBetweenAttacks > 0.09f)
        {
            TrashMan.spawn("Instantiated_Bullet", shieldMuzzle.transform.position, shieldMuzzle.transform.rotation);
            Attack("Projectile_Player", numberProjectiles);
            count = 0;
            timeBetweenAttacks = 0;
        }

        if (Input.touchCount > 0)
        {
            //Store the first touch detected.
            Touch myTouch = Input.touches[0];
            if (myTouch.phase == TouchPhase.Began)
            {
                if (canChangeColor == true)
                {
                    changeColorPlayer(actualColor);
                    changeColorShield(actualColor);
                    canChangeColor = false;
                }
            }

            if (myTouch.phase == TouchPhase.Ended)
            {
                canChangeColor = true;
            }

            //Check if the phase of that touch equals Began
            if (myTouch.phase == TouchPhase.Began || myTouch.phase == TouchPhase.Moved)
            {
                targetMove   = Camera.main.ScreenToWorldPoint(new Vector3(Input.GetTouch(0).position.x, Input.GetTouch(0).position.y, Camera.main.nearClipPlane));
                targetMove.z = 0;

                if (move == false)
                {
                    move = true;
                }
            }
            if (move == true)
            {
                transform.position = targetMove;
            }
            //transform.position = Vector3.MoveTowards(transform.position, targetMove, speed* Time.deltaTime);
        }
#endif
        if (isInvulnerable == true)
        {
            changeColorPlayer(2);
            changeColorShield(2);
        }

        if (dead == true)
        {
            deathCount += 1 * Time.deltaTime;
            TrashMan.spawn("VFX_DEATH_PLAYER", transform.position, transform.rotation);
            if (deathCount > 1.5f)
            {
                Die();
            }
        }
    }
Exemplo n.º 28
0
 // Use this for initialization
 void Start()
 {
     managerScene = (ManagerScene)GameObject.FindObjectOfType(typeof(ManagerScene));
 }