Inheritance: MonoBehaviour
Esempio n. 1
0
 void Start()
 {
     phpSender = GameObject.Find("Nameholder").GetComponent<PhpSender>();
     hitSound = GetComponent<AudioSource>();
     shake = GameObject.Find("Main Camera").GetComponent<Shake>();
     hitParticle = GetComponentInChildren<ParticleSystem>();
     balloon = GameObject.Find("Balloon");
     balloon.transform.position = transform.position;
     cameraObject = GameObject.Find("Main Camera");
     animator = GetComponent<Animator>();
 }
Esempio n. 2
0
        public List <Shake> ObterTodos()
        {
            List <Shake> shake = new List <Shake>();

            string[] linhas = File.ReadAllLines(PATH);
            foreach (var linha in linhas)
            {
                Shake    s     = new Shake();
                string[] dados = linha.Split(";");
                s.Nome  = dados[0];
                s.Preco = double.Parse(dados[1]);
                shake.Add(s);
            }
            return(shake);
        }
Esempio n. 3
0
    void Start()
    {
        rb = GetComponent <Rigidbody>();
        //메쉬필터 컴포넌트 추출 후 저장
        meshFilter = GetComponent <MeshFilter>();
        //메쉬랜더 컴포넌트 추출, 저장 후 랜덤으로 적용
        _renderer = GetComponent <MeshRenderer>();
        //오디오 컴포넌트를 추출해 저장
        _audio = GetComponent <AudioSource>();

        shake = GameObject.Find("CameraRig").GetComponent <Shake>();

        //난수를 발생시켜 불규칙적인 텍스쳐 적용
        _renderer.material.mainTexture = testures[Random.Range(0, testures.Length)];
    }
Esempio n. 4
0
    public void ShakeScreen(Vector2 magnitude, float duration, int count)
    {
        float individualDuration = duration / (float)count;

        for (int i = 0; i < count; i++)
        {
            Shake newShake = new Shake
                             (
                magnitude,
                individualDuration
                             );

            shakeQueue.Add(newShake);
        }
    }
Esempio n. 5
0
        public bool addShake(string name, string time)
        {
            var model = new Shake()
            {
                id        = Guid.NewGuid(),
                username  = name,
                shakeTime = DateTime.Parse(time),
            };

            if (ShakeAccess.Exist(name))
            {
                return(ShakeAccess.update(model));
            }
            return(ShakeAccess.Add(model));
        }
Esempio n. 6
0
        public List <Shake> Listar()
        {
            var registros = File.ReadAllLines(PATH);

            foreach (var item in registros)
            {
                var   valores = item.Split(";");
                Shake shake   = new Shake();
                shake.Nome  = valores[1];
                shake.Preco = double.Parse(valores[2]);

                this.Shakes.Add(shake);
            }
            return(this.Shakes);
        }
Esempio n. 7
0
 // Start is called before the first frame update
 void Start()
 {
     //Rigidbody 컴포넌트를 추출해 저장
     rb = GetComponent <Rigidbody>();
     //MeshFilter 컴포넌트를 추출해 저장
     meshFilter = GetComponent <MeshFilter>();
     //MeshRenderer 컴포넌트를 추출해 저장
     _renderer = GetComponent <MeshRenderer>();
     //AudioSource 컴포넌트를 추출해 저장
     _audio = GetComponent <AudioSource>();
     //Shake 스크립트를 추출
     shake = GameObject.Find("CameraRig").GetComponent <Shake>();
     //난수를 발생시켜 불규칙적인 텍스처를 적용
     _renderer.material.mainTexture = textures[UnityEngine.Random.Range(0, textures.Length)];
 }
    // Update is called once per frame
    void Update()
    {
        //Lerp back to original position but not as aggressively.
        if (shakes.Count > 0)
        {
            camShake.transform.localPosition = Vector3.Lerp(camShake.transform.localPosition, Vector3.zero, Time.deltaTime * 5);
            camShake.transform.localRotation = Quaternion.Lerp(camShake.transform.localRotation, Quaternion.identity, Time.deltaTime * 5);
        }

        //Check and mark for finished shakes.
        foreach (Shake shake in shakes)
        {
            if (shake.startTime + shake.duration < Time.time)
            {
                shake.finished = true;

                //camShake.transform.localPosition = Vector3.zero;
                //camShake.transform.localRotation = Quaternion.identity;
                //Reset the camera to its original position once the shake is done.
                //mainCam.transform.Translate(mainCam.transform.localPosition - shake.originalLocalPosition); //Reset position by subtracting the original difference.
                //mainCam.transform.Translate(shake.positionChanges * -1);
                //This line doesn't always reset the rotation properly.
                //mainCam.transform.Rotate((mainCam.transform.localRotation * Quaternion.Inverse(shake.originalLocalRotation)).eulerAngles); //Reset rotation by subtracting original difference.

                //mainCam.transform.localRotation = mainCam.transform.localRotation * Quaternion.Inverse(shake.rotationChanges);
                //mainCam.transform.localRotation = shake.originalLocalRotation;
                camShake.transform.Translate(shake.positionChanges);
                camShake.transform.localRotation = shake.originalLocalRotation;
            }
        }

        //Filter out finished shakes
        shakes = (from s in shakes where !s.finished select s).ToList <Shake>();

        //Find the strongest shake and quake it.
        if (shakes.Count > 0)
        {
            Shake strongestShake = shakes.OrderByDescending(s => s.intensity).First();
            Quake(strongestShake);
        }

        //Lerp back aggressively to original position if no shakes.
        if (shakes.Count == 0)
        {
            camShake.transform.localPosition = Vector3.Lerp(camShake.transform.localPosition, Vector3.zero, 0.15f / Time.deltaTime);
            camShake.transform.localRotation = Quaternion.Lerp(camShake.transform.rotation, Quaternion.identity, 0.15f / Time.deltaTime);
        }
    }
Esempio n. 9
0
        public IActionResult Registrar(IFormCollection form)
        {
            ViewData["Action"] = "Pedido";
            Pedido pedido = new Pedido();

            Shake shake     = new Shake();
            var   nomeShake = form["shake"];

            shake.Nome  = nomeShake;
            shake.Preco = shakeRepository.ObterPrecoDe(nomeShake);

            pedido.Shake = shake;

            var        nomeHamburguer = form["hamburguer"];
            Hamburguer hamburguer     = new Hamburguer(
                nomeHamburguer,
                hamburguerRepository.ObterPrecoDe(nomeHamburguer));

            pedido.Hamburguer = hamburguer;

            Cliente cliente = new Cliente()
            {
                Nome     = form["nome"],
                Endereco = form["endereco"],
                Telefone = form["telefone"],
                Email    = form["email"]
            };

            pedido.Cliente = cliente;

            pedido.DataDoPedido = DateTime.Now;

            pedido.PrecoTotal = hamburguer.Preco + shake.Preco;

            if (pedidoRepository.Inserir(pedido))
            {
                return(View("Sucesso", new RespostaViewModel()
                {
                    NomeView = "Pedido",
                    UsuarioEmail = ObterUsuarioSession(),
                    UsuarioNome = ObterUsuarioNomeSession()
                }));
            }
            else
            {
                return(View("Erro", new RespostaViewModel("Mensagem")));
            }
        }
Esempio n. 10
0
        static void Demo4()
        {
            Animal[] animals = new Animal[5];
            animals[0] = new Cat();
            animals[1] = new Fish();
            animals[2] = new Shake();
            animals[3] = new Fish();
            animals[4] = new Cat();

            foreach (Animal animal in animals)
            {
                animal.Sound();
                animal.Move();
                Console.WriteLine("-----------------");
            }
        }
Esempio n. 11
0
 public void GetShakes(int index)
 {
     if (index < Shakes.Count && index > -1)
     {
         Shake shake = Shakes[index];
         Messages.Add(shake.GetTemplate());
         if (shake is Shake)
         {
             Shake shakeMenu = (Shake)shake;
         }
     }
     else
     {
         Messages.Add("Invalid Choice... Find a Real Shake");
     }
 }
Esempio n. 12
0
    public override void Start()
    {
        base.Start();
        Team.monsterNumber += 1;

        shake      = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent <Shake> ();
        matDefault = gfx.GetComponent <SpriteRenderer> ().material;

        moveState           = new Golem_MoveState(this, stateMachine, "move", moveStateData, this);
        idleState           = new Golem_IdleState(this, stateMachine, "idle", idleStateData, this);
        playerDetectedState = new Golem_PlayerDetectedState(this, stateMachine, "playerDetected", playerDetectedData, this);
        chargeState         = new Golem_ChargeState(this, stateMachine, "charge", chargeStateData, this);
        lookForPlayerState  = new Golem_LookForPlayerState(this, stateMachine, "lookForPlayer", lookForPlayerData, this);
        meleeAttackState    = new Golem_MeleeAttackState(this, stateMachine, "meleeAttack", meleeAttackPosition, meleeAttackStateData, this);
        stateMachine.Initialize(moveState);
    }
Esempio n. 13
0
    /*
     *  1 - Runner
     *  2 - Climber
     *  3 - Hacker
     *  4 - Tracker
     *  5 - Tank
     *  6 - Grenadier
     */
    void Awake()
    {
        shake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent <Shake>();
        UpdateStats();
        int i = 0;

        foreach (var member in interfaceTeam)
        {
            member.GetComponent <ArchetypeInterface>().archetype = Team.team[i].archetype;
            member.GetComponent <ArchetypeInterface>().weapon    = Team.team[i].weaponType;
            member.GetComponent <ArchetypeInterface>().trait     = Team.team[i].trait;
            i += 1;
        }
        interfaceTeam[currentChar].GetComponent <ArchetypeInterface>().isSelected = true;
        currentHealth = maxHealth;
    }
Esempio n. 14
0
    // Start is called before the first frame update
    void Start()
    {
        //FirePos 하위에 있는 컴포넌트 추출
        muzzleFlash = firePos.GetComponentInChildren <ParticleSystem>();
        //AudioSource 컴포넌트 추출
        _audio = GetComponent <AudioSource>();
        //Shake 스크립트를 추출
        shake = GameObject.Find("CameraRig").GetComponent <Shake>();

        //적 캐릭터의 레이어 값을 추출
        enemyLayer = LayerMask.NameToLayer("ENEMY");
        //장애물의 레이어 값을 추출
        obstacleLayer = LayerMask.NameToLayer("OBSTACLE");
        //레이어 마스크의 비트 연산(OR 연산)
        layerMask = 1 << obstacleLayer | 1 << enemyLayer;
    }
Esempio n. 15
0
    // Initialize Class after LoadScene
    IEnumerator GetShake()
    {
        while (!UnityEngine.SceneManagement.SceneManager.GetSceneByName("Play").isLoaded)
        {
            yield return(null);
        }
        rb         = GetComponent <Rigidbody>();
        meshFilter = GetComponent <MeshFilter>();
        _renderer  = GetComponent <MeshRenderer>();
        _audio     = GetComponent <AudioSource>();

        shake = GameObject.Find("CameraRig").GetComponent <Shake>();

        //난수를 발생시켜 불규칙적인 텍스처를 적용
        _renderer.material.mainTexture = textures[Random.Range(0, textures.Length)];
    }
Esempio n. 16
0
    private void Start()
    {
        _audio         = GetComponent <AudioSource>();
        _shake         = GetComponent <Shake>();
        _shake.enabled = false;

        _hoverText = GetComponent <HoverText>();
        _hoverText.SetText("Įjungti muziką");

        if (_songs.Any())
        {
            _audio.clip = _songs[0];
        }

        SubscribeEvents();
    }
Esempio n. 17
0
    void Start()
    {
        CameraManager      = new GameObject().transform;
        CameraManager.name = "_Camera Manager";

        Zoom      = new GameObject().transform;
        Zoom.name = "_Zoom";

        transform.parent = Zoom;
        Zoom.parent      = CameraManager;

        transform.position = Vector3.zero;
        transform.rotation = Quaternion.identity;

        shaker = GetComponent <Shake>();
    }
Esempio n. 18
0
    void Awake()
    {
        var player = GameObject.FindGameObjectWithTag("PLAYER"); //주인공 게임오브젝트 추출

        if (player != null)
        {
            playerTr = player.GetComponent <Transform>(); //주인공 Transform 추출
        }
        enemyTr   = GetComponent <Transform>();           // 적 Transform 추출
        animator  = GetComponent <Animator>();
        moveAgent = GetComponent <MoveBoss>();
        audio     = GetComponent <AudioSource>();
        shake     = GameObject.Find("OVRPlayerController").GetComponent <Shake>();

        ws = new WaitForSeconds(0.3f); //코루틴 지연시간 생성
    }
Esempio n. 19
0
        public IActionResult RegistrarPedido(IFormCollection form)
        {
            System.Console.WriteLine(form["nome"]);
            System.Console.WriteLine(form["endereco"]);
            System.Console.WriteLine(form["telefone"]);
            System.Console.WriteLine(form["email"]);
            System.Console.WriteLine(form["hamburguer"]);
            System.Console.WriteLine(form["shake"]);

            Pedido pedido = new Pedido();

            // Forma 1 - Mais comum
            Cliente cliente = new Cliente();

            cliente.Nome     = form["nome"];
            cliente.Endereco = form["endereco"];
            cliente.Telefone = form["telefone"];
            cliente.Email    = form["email"];

            pedido.Cliente = cliente;

            // Forma 2 - Usa parâmetros nos construtores
            Hamburguer hamburguer = new Hamburguer(
                Nome: form["hamburguer"],
                Preco: hamburguerRepositorio.ObterPrecoDe(form["hamburguer"])
                );

            pedido.Hamburguer = hamburguer;

            // Forma 3 - Resumo da Forma 1
            Shake shake = new Shake()
            {
                Nome  = form["shake"],
                Preco = shakeRepositorio.ObterPrecoDe(form["shake"])
            };

            pedido.Shake = shake;

            pedido.PrecoTotal = pedido.Hamburguer.Preco + pedido.Shake.Preco;

            Repositorio.Inserir(pedido);


            ViewData["NomeView"] = "Pedido";

            return(View("Sucesso"));
        }
Esempio n. 20
0
        public IActionResult RegistrarPedido(IFormCollection form)
        {
            System.Console.WriteLine(form["nome"]);
            System.Console.WriteLine(form["endereco"]);
            System.Console.WriteLine(form["telefone"]);
            System.Console.WriteLine(form["email"]);
            System.Console.WriteLine(form["hamburguer"]);
            System.Console.WriteLine(form["shake"]);


            Pedido pedido = new Pedido();
            //INSTANCIAR OBJETO - forma 1
            Cliente cliente = new Cliente();

            cliente.Nome     = form["nome"];
            cliente.Endereco = form["endereco"];
            cliente.Telefone = form["telefone"];
            cliente.Email    = form["email"];

            pedido.Cliente = cliente;

            //INSTANCIAR OBJETO - geração de construtor
            Hamburguer hamburguer = new Hamburguer(
                Nome: form["hamburguer"],
                Preco: hamburguerRepositorio.ObterPrecoDe(form["hamburguer"])
                );

            pedido.Hamburguer = hamburguer;


            //INSTANCIAR OBJETO - resumo da forma 1
            Shake shake = new Shake()
            {
                Nome  = form["shake"],
                Preco = shakeRepositorio.ObterPrecoDe(form["shake"])
            };

            pedido.Shake      = shake;
            pedido.PrecoTotal = pedido.Hamburguer.Preco + pedido.Shake.Preco;
            pedido.DataPedido = DateTime.Now;

            pedidoRepositorio.Inserir(pedido);

            ViewData["Controller"] = "Pedido";

            return(View("Sucesso"));
        }
Esempio n. 21
0
    static int get_playOnEnable(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Shake obj = (Shake)o;
            bool  ret = obj.playOnEnable;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index playOnEnable on a nil value" : e.Message));
        }
    }
Esempio n. 22
0
    static int get_shakeTime(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Shake obj = (Shake)o;
            float ret = obj.shakeTime;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index shakeTime on a nil value" : e.Message));
        }
    }
Esempio n. 23
0
    static int set_target(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Shake obj = (Shake)o;
            UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Transform));
            obj.target = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index target on a nil value" : e.Message));
        }
    }
Esempio n. 24
0
    static int set_playOnEnable(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Shake obj  = (Shake)o;
            bool  arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.playOnEnable = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index playOnEnable on a nil value" : e.Message));
        }
    }
Esempio n. 25
0
        public List <Shake> ObterTodos()

        {
            List <Shake> shakes = new List <Shake>();


            string[] linhas = File.ReadAllLines(PATH);
            foreach (var linha in linhas) // para cada linha de "linhas"
            {
                Shake    x     = new Shake();
                string[] dados = linha.Split(";");
                x.Nome  = dados[0]; // irá verificar o valor de cada linha da lista
                x.Preco = double.Parse(dados[1]);
                shakes.Add(x);      //passa os dados para sua lista
            }
            return(shakes);
        }
Esempio n. 26
0
    static int set_shakeTime(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Shake obj  = (Shake)o;
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.shakeTime = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index shakeTime on a nil value" : e.Message));
        }
    }
Esempio n. 27
0
    static int get_target(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Shake obj = (Shake)o;
            UnityEngine.Transform ret = obj.target;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index target on a nil value" : e.Message));
        }
    }
Esempio n. 28
0
        void DrillFX(Vector2 direction, RayCastData rayCastData)
        {
            SoundManager.PlaySound(SoundManager.SoundEnum.Drill);

            if (ShovelAnim != null)
            {
                ShovelAnim.StartAnimation(direction.X);
            }
            if (Shake != null)
            {
                Shake.InitShake(ShakeData);
            }
            if (fxManager != null)
            {
                fxManager.CreateParticleSystem(rayCastData.Pos);
            }
        }
Esempio n. 29
0
        public IActionResult Registrar(IFormCollection form)
        {
            ViewData["Action"] = "Pedido";
            Pedido pedido = new Pedido();

            var   nomeShake = form["shake"];
            Shake shake     = new Shake(nomeShake, shakeRepository.ObterPrecoDe(nomeShake));

            pedido.Shake = shake;


            var        nomeHamburguer = form["hamburguer"];
            Hamburguer hamburguer     = new Hamburguer(nomeHamburguer, hamburguerRepository.ObterPrecoDe(nomeHamburguer));

            pedido.Hamburguer = hamburguer;


            Cliente cliente = new Cliente();

            cliente.Nome     = form["nome"];
            cliente.Endereco = form["endereco"];
            cliente.Telefone = form["telefone"];
            cliente.Email    = form["email"];

            pedido.Cliente      = cliente;
            pedido.DataDoPedido = DateTime.Now;
            pedido.PrecoTotal   = hamburguer.Preco + shake.Preco;

            if (pedidoRepository.Inserir(pedido))
            {
                return(View("Sucesso", new RespostaViewModel()
                {
                    NomeView = "Pedido",
                    Mensagem = $"{cliente.Nome} seu pedido foi concluído!"
                }));
            }
            else
            {
                return(View("Erro", new RespostaViewModel()
                {
                    NomeView = "Pedido",
                    Mensagem = $"{cliente.Nome} seu pedido não foi concluído!"
                }));
            }
        }
Esempio n. 30
0
        public IActionResult RegistrarPedido(IFormCollection form)
        {
            System.Console.WriteLine(form["nome"]);
            System.Console.WriteLine(form["endereco"]);
            System.Console.WriteLine(form["telefone"]);
            System.Console.WriteLine(form["email"]);
            System.Console.WriteLine(form["hamburguer"]);
            System.Console.WriteLine(form["shake"]);

            Pedido pedido = new Pedido();

            // Instanciação de objeto - Forma 1
            Cliente cliente = new Cliente();

            cliente.Nome     = form["nome"];
            cliente.Endereco = form["endereco"];
            cliente.Telefone = form["telefone"];
            cliente.Email    = form["email"];

            pedido.Cliente = cliente;

            // Instanciação de objeto - Forma 2 (pede geração de construtor)
            Hamburguer hamburguer = new Hamburguer(
                Nome: form["hamburguer"]

                );

            pedido.Hamburguer = hamburguer;

            // Instanciação de objeto - Forma 3 (resumo da Forma 1)
            Shake shake = new Shake()
            {
                Nome = form["shake"]
            };

            pedido.Shake = shake;

            pedido.DataPedido = DateTime.Now;

            pedidoRepositorio.Inserir(pedido);

            ViewData["Controller"] = "Pedido";

            return(View("Sucesso"));
        }
Esempio n. 31
0
    void Start()
    {
        s = Camera.main.GetComponent <Shake>();
        this.transform.position = currentPosition = initialPosition;
        currentArmRot           = 0;
        sceneM.Reset();
        canTakeDamage   = true;
        timeSinceDamage = 0.5f;
        health          = 3;

        hearts = new List <GameObject>();
        for (int i = -1; i < 2; i++)
        {
            hearts.Add(Instantiate(heart, new Vector2(i, 3.5f), Quaternion.identity));
        }
        sceneM.Reset();
        lost = false;
    }
Esempio n. 32
0
    // Use this for initialization
    void Start()
    {
        ho = GetComponent<AudioSource>();
        camShake = Camera.main.GetComponent<Shake>();
        bgCol = bg.color;

        for (int i = 0; i < turnOffsBio.Length; ++i)
        {
            turnOffsBio[i].GetComponent<SelectToBio>().SetActive(false);
        }

        for (int i = 0; i < turnOffsLocked.Length; ++i)
        {
            turnOffsLocked[i].GetComponent<LockedEffect>().SetActive(false);
        }

        badgeButton.SetActive(false);
        backButton.SetActive(false);
        textT = badgeText.transform;
        badgeText.SetActive(true);
    }
Esempio n. 33
0
    // Use this for initialization
    void Start()
    {
        time = 0;
        effect = Camera.main.GetComponent<effects>();

        #if UNITY_WP8
        PlayerPrefs.SetInt("125progress", 100);
        PlayerPrefs.SetInt("90progress", 100);
        #endif
        if(PlayerPrefs.HasKey("unlockedBear"))
        {
            GlobalData.alreadyUnlockedBear = true;
        } else
        {
            GlobalData.alreadyUnlockedBear = false;
        }

        if(PlayerPrefs.HasKey("unlockedBull"))
        {
            GlobalData.alreadyUnlockedBull = true;
        } else
        {
            GlobalData.alreadyUnlockedBull = false;
        }

        GlobalData.unlockingBear = false;
        GlobalData.unlockingBull = false;

        SetDigits[] rhinoPercentage = unlockedRhino.GetComponentsInChildren<SetDigits>();
        SetDigits[] bearPercentage = unlockedBear.GetComponentsInChildren<SetDigits>();
        SetDigits[] bullPercentage = unlockedBull.GetComponentsInChildren<SetDigits>();

        SetStars[] rhinoStars = unlockedRhino.GetComponentsInChildren<SetStars>();
        SetStars[] bearStars = unlockedBear.GetComponentsInChildren<SetStars>();
        SetStars[] bullStars = unlockedBull.GetComponentsInChildren<SetStars>();

        bool bearActive = false;
        bool bullActive = false;
        int bearProgress = 0;
        int rhinoProgress = 0;
        int bullProgress = 0;

        int rhinoStarsCount = 0;
        int bearStarsCount = 0;
        int bullStarsCount = 0;
        if(PlayerPrefs.HasKey("90stars"))
        {
            rhinoStarsCount = PlayerPrefs.GetInt("90stars");
        }
        if(PlayerPrefs.HasKey("125stars"))
        {
            bearStarsCount = PlayerPrefs.GetInt("125stars");
        }
        if(PlayerPrefs.HasKey("160stars"))
        {
            bullStarsCount = PlayerPrefs.GetInt("160stars");
        }

        if(PlayerPrefs.HasKey("90progress"))
        {
            int progress90 = PlayerPrefs.GetInt("90progress");
            if(progress90 >= 60)
            {
                bearActive = true;
                if(!GlobalData.alreadyUnlockedBear)
                {
                    GlobalData.unlockingBear = true;
                    lockedBear.SetActive(true);
                    unlockedBear.SetActive(false);
                }
                else
                {
                    lockedBear.SetActive(false);
                    unlockedBear.SetActive(true);
                }
            }
            else
            {
                lockedBear.SetActive(true);
                unlockedBear.SetActive(false);
            }
            rhinoProgress = progress90;
        }
        else
        {
            lockedBear.SetActive(true);
            unlockedBear.SetActive(false);
        }

        if(PlayerPrefs.HasKey("125progress"))
        {
            int progress125 = PlayerPrefs.GetInt("125progress");
            if(progress125 >= 60)
            {
                bullActive = true;
                if(!GlobalData.alreadyUnlockedBull)
                {
                    GlobalData.unlockingBull = true;
                    lockedBull.SetActive(true);
                    unlockedBull.SetActive(false);
                } else
                {
                    lockedBull.SetActive(false);
                    unlockedBull.SetActive(true);
                }
            }
            else
            {
                lockedBull.SetActive(true);
                unlockedBull.SetActive(false);
            }
            bearProgress = progress125;
        }
        else
        {
            lockedBull.SetActive(true);
            unlockedBull.SetActive(false);
        }

        if(PlayerPrefs.HasKey("160progress"))
        {
            int progress160 = PlayerPrefs.GetInt("160progress");
            bullProgress = progress160;
        }

        rhinoPercentage[0].SetNumber(rhinoProgress);
        rhinoStars[0].SetStarsActive(rhinoStarsCount);
        if(bearActive)
        {
            bearPercentage[0].SetNumber(bearProgress);
            bearStars[0].SetStarsActive(bearStarsCount);
        }
        if(bullActive)
        {
            bullPercentage[0].SetNumber(bullProgress);
            bullStars[0].SetStarsActive(bullStarsCount);
        }

        cameraShake = Camera.main.GetComponent<Shake>();

        if (bearActive && bullActive && rhinoProgress == 100 && bearProgress == 100 && bullProgress == 100)
        {
            if (PlayerPrefs.HasKey("ctaShown"))
            {
                badgeButton.SetActive(true);
                ctaButton.SetActive(false);
                ctaBG.SetActive(false);
            }
            else
            {
                badgeButton.SetActive(false);
                ctaButton.SetActive(true);
                ctaBG.SetActive(true);
            }

        }
        else
        {
            badgeButton.SetActive(false);
            ctaButton.SetActive(false);
            ctaBG.SetActive(false);
        }
    }
    // Use this for initialization
    void Start()
    {
        effectObject = GameObject.Find("Offbeat");

        fxParticles = new GameObject[2];
        fxParticles[0] = Instantiate(FXParticles);
        fxParticles[1] = Instantiate(FXParticles);
        fxParticlesControl = new CustomParticles[2];
        fxParticlesControl[0] = fxParticles[0].GetComponent<CustomParticles>();
        fxParticlesControl[1] = fxParticles[1].GetComponent<CustomParticles>();

        touches = new Vector3[2];
        deadBunnies =0;
        fxPointer = 0;
        latestTouch = 0;
        time = 0;
        god = GameObject.Find("God").GetComponent<GodDeath>();
        pause = GameObject.Find("Pause").GetComponent<Pause>();
        uint bunnyCount = 0;
        float distanceCoef = (700.0f / 500.0f);
        beat = 0.66666f;
        float expectedBunnyLifetime = GetJumpTimeFromLinearTime((350.0f / (250.0f)) * distanceCoef, beat);

        int latestColor = 0;
        Color []colors = new Color[3]{
            new Color(0,1.0f,59 / 255.0f),
            new Color(0,255 / 255.0f,187 / 255.0f),
            new Color(97 / 255.0f,0,255 / 255.0f),
        };

        float realDuration = 0;
        float []angles = new float[5]{Mathf.PI / 2.0f, 4.6f, 2.65f, 5.6f, 1.4f};
        for (int i = 0; i < 5; i++)
        {
            float endTime = i * beat + expectedBunnyLifetime;
            GameObject bunny = (GameObject) Instantiate(bunnyPrefab);
            BunnyJump bunnyJumpS = bunny.GetComponent<BunnyJump>();
            bunnyJumpS.startTime = 2 * i * 0.66666f + 1.0f * 0.666666f + (i == 0 ? 0 : 2.0f * 0.66666f);;
            bunnyJumpS.expectedBunnyLifetime = expectedBunnyLifetime;
            bunnyJumpS.beat = beat;
            bunnyJumpS.god = god;
            bunnyJumpS.angle = angles[i];
            bunnyJumpS.wiggleSpace = 0.1f;
            bunnyJumpS.velocityMod = false;
            int randomColor = Random.Range(0,3);
            while(randomColor == latestColor || randomColor == GlobalData.godIndex)
            {
                randomColor = Random.Range(0,3);
            }
            latestColor = randomColor;
            bunnyJumpS.color = colors[randomColor];
            bunnyJumpS.Startingu();
            bunnyJumpS.Init();

            bunnyCount++;
            bunnies.Add(bunnyJumpS);
        }

        cameraMiss = Camera.main.GetComponent<MissFrame>();
        cameraShake = Camera.main.GetComponent<Shake>();
    }
Esempio n. 35
0
	void Start () {

		GameObject gui = GameObject.FindGameObjectWithTag ("_gui_");
		if(gui != null){
			my_game_uGUI = GameObject.FindGameObjectWithTag("_gui_").GetComponent<game_uGUI>();
			
		}

		countTimes = 1;
		if(ifShake){
		cameraShake = cameraObject.GetComponent(typeof(Shake)) as Shake;
		}
		//objectShake = cubeObject.GetComponent(typeof(Shake)) as Shake;
//		Explotion.SetActive (false);
	//	GameObject effect= GameObject.Find ("CFXM2_GroundWoodHit Bigger Dark");
	//	effect.SetActive (false);
//		EffectLoseGravity.SetActive (false);
		//EffectLoseGravity2.SetActive (false);
		//EffectLoseGravity3.SetActive (false);
		//EffectLoseGravity4.SetActive (false);
	}
Esempio n. 36
0
	void Start () {
		Application.targetFrameRate = 60;

		shake = Camera.main.GetComponent<Shake>();
		effect = Camera.main.GetComponent<effects>();
		

		particles.transform.position = new Vector3(0,0,0);
		particlesControl = particles.GetComponent<CustomParticles>();
		length = timeSource.clip.length;
		d1 = num1.GetComponent<SpriteRenderer>();
		d2 = num2.GetComponent<SpriteRenderer>();
		cTransform = num1.GetComponent<Transform>();
		beat = GlobalData.beat;
		currentCount = Mathf.FloorToInt(length / beat);
		freq = 1.0f / timeSource.clip.frequency;
		timeSource.Play();

		wiggleSpace = GlobalData.wiggleSpace;

		offBeatObjects = new GameObject[2];
		offBeatObjects[0] = Instantiate(offbeat);
		offBeatObjects[1] = Instantiate(offbeat);
		offBeatObjects[0].SetActive(false);
		offBeatObjects[1].SetActive(false);

		offBeatCounter = 0;
		effectObject = GameObject.Find("Offbeat");

		fxParticles = new GameObject[2];
		fxParticles[0] = Instantiate(FXParticles);
		fxParticles[1] = Instantiate(FXParticles);
		fxParticlesControl = new CustomParticles[2];
		fxParticlesControl[0] = fxParticles[0].GetComponent<CustomParticles>();
		fxParticlesControl[1] = fxParticles[1].GetComponent<CustomParticles>();


		switch(GlobalData.selectedGod)
		{
			case GlobalData.Gods.RHINO:
					fxParticlesControl[0].SetColors(rhinoColors1);
					fxParticlesControl[1].SetColors(rhinoColors1);
					break;
				case GlobalData.Gods.BEAR:
					fxParticlesControl[0].SetColors(bearColors1);
					fxParticlesControl[1].SetColors(bearColors1);
					break;
				case GlobalData.Gods.BULL:
					fxParticlesControl[0].SetColors(bullColors1);
					fxParticlesControl[1].SetColors(bullColors1);
				break;
		}
	}
Esempio n. 37
0
 void Start()
 {
     shake = Camera.main.GetComponent<Shake>();
     effectz = Camera.main.GetComponent<effects>();
 }
Esempio n. 38
0
 void Start()
 {
     gameControllerObj = GameObject.FindGameObjectWithTag("GameController");
     shake = gameControllerObj.GetComponent<Shake>();
     timeController = gameControllerObj.GetComponent<TimeController>();
 }
Esempio n. 39
0
	void Awake() {
	    _instance = this;
		initialPosition = transform.position;
	    initialRotation = transform.rotation;
	}
Esempio n. 40
0
	void Start () {
		cameraShake = cameraObject.GetComponent(typeof(Shake)) as Shake;
		objectShake = cubeObject.GetComponent(typeof(Shake)) as Shake;
	}
Esempio n. 41
0
	void Start () {
	    rb = GetComponent< Rigidbody >();
        audio = GetComponent< AudioSource >();
        shake = FindObjectOfType< Shake >();
	}
Esempio n. 42
0
	void Start () {


		count = 0;
		distance = 0;
		D2D_DamageOnCollision.UsedSlowMotionActivated =false;


		GameObject gui = GameObject.FindGameObjectWithTag ("_gui_");
		if(gui != null){
			my_game_uGUI = GameObject.FindGameObjectWithTag("_gui_").GetComponent<game_uGUI>();
			
		}
		
		countTimes = 1;
		if(ifShake){
			cameraShake = cameraObject.GetComponent(typeof(Shake)) as Shake;
		}

	}
Esempio n. 43
0
    // Use this for initialization
    void Start()
    {
        GameObject bunn = GameObject.Find("Bunnies");
        if(bunn)
        {
            bunnies = bunn.GetComponent<Bunnies>();
        }
        cameraShake = Camera.main.GetComponent<Shake>();
        cR = GetComponent<SpriteRenderer>();
        timeOfDeath = 0;
        ingameUI = GameObject.FindGameObjectsWithTag("IngameUI");
        ingameRends = new SpriteRenderer[ingameUI.Length];
        for(int i =0; i < ingameUI.Length; ++i)
        {
            ingameRends[i] = ingameUI[i].GetComponent<SpriteRenderer>();
        }
        gameoverUI = GameObject.FindGameObjectsWithTag("GameOverUI");
        goRends = new SpriteRenderer[gameoverUI.Length];
        for(int i =0; i < gameoverUI.Length; ++i)
        {
            goRends[i] = gameoverUI[i].GetComponent<SpriteRenderer>();
        gameoverUI[i].SetActive(false);
        }
        if(GOPercentage)
        {
            GOPercentageS = GOPercentage.GetComponent<Percentage>();
        }
        t = 0;

        gameOverAudio = GetComponent<AudioSource>();
    }
Esempio n. 44
0
	void Awake() {
		shake = target.GetComponent<Shake>();
	}
Esempio n. 45
0
	void Start () {
		cTransform = GetComponent<Transform>();
		scale = cTransform.localScale;
		camShake = Camera.main.GetComponent<Shake>();
	}
Esempio n. 46
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;
        loaded = false;
        offBeatObjects = new GameObject[2];
        offBeatObjects[0] = Instantiate(offbeat);
        offBeatObjects[1] = Instantiate(offbeat);
        offBeatObjects[0].SetActive(false);
        offBeatObjects[1].SetActive(false);

        offBeatCounter = 0;

        nextPermittedBeat = 0;
        GlobalData.GOButtonsReady = false;

        touches = new Vector3[2];
        screenHeight = Camera.main.orthographicSize * 2.0f;
        screenWidth = Camera.main.aspect * screenHeight;

        effect = Camera.main.GetComponent<effects>();
        cameraMiss = Camera.main.GetComponent<MissFrame>();
        cameraShake = Camera.main.GetComponent<Shake>();

        latestTouch = 0;
        lastTouchPosition = new Vector2(100, 100);
        fxParticles = new GameObject[2];
        fxParticles[0] = Instantiate(FXParticles);
        fxParticles[1] = Instantiate(FXParticles);
        fxParticlesControl = new CustomParticles[2];
        fxParticlesControl[0] = fxParticles[0].GetComponent<CustomParticles>();
        fxParticlesControl[1] = fxParticles[1].GetComponent<CustomParticles>();

        UpdateColors();

        fxPointer = 0;
        wrongClicks = 0;
        beat = GlobalData.beat;

        wiggleSpace = GlobalData.wiggleSpace;

        time = 0;
        god = GameObject.Find("God").GetComponent<GodDeath>();
        /* PAUSE READY
        pause = GameObject.Find("Pause").GetComponent<Pause>();
        */
        bool missed = false;
        uint oneInXMissing = 3;
        float distanceCoef = (700.0f / 500.0f);
        float expectedBunnyLifetime = GetJumpTimeFromLinearTime((350.0f / (250.0f)) * distanceCoef, beat) / (0.48f / beat);

        realDuration = 0;
        if (audio.clip)
            realDuration = audio.clip.length;
        if (percentage)
        {
            percentageS = percentage.GetComponent<Percentage>();
            percentageS.realDuration = Mathf.Floor((realDuration - expectedBunnyLifetime) / beat) * beat + expectedBunnyLifetime;
        }

        if (GOPercentage)
        {
            GOPercentageS = GOPercentage.GetComponent<Percentage>();
            GOPercentageS.realDuration = Mathf.Floor((realDuration - expectedBunnyLifetime) / beat) * beat + expectedBunnyLifetime;
        }

        float[] angles = new float[5] { Mathf.PI / 2.0f, 4.6f, 2.65f, 5.6f, 1.4f };
        if (beat == 0.375f)
        {
            oneInXMissing = 5;
        }
        effectObject = GameObject.Find("Offbeat");

        GameObject bunnObject = GameObject.Find("Bunnies");
        if (bunnObject)
        {
            bunz = bunnObject.GetComponent<Bunnies>();
        }
        GameObject screen = GameObject.Find("Screen");
        int latestColor = 0;
        Color[] colorsRhino = new Color[3]{
            new Color(0,1.0f,91.0f / 255.0f),
            new Color(0,1.0f,187.0f / 255.0f),
            new Color(144.0f / 255.0f,0,1),
        };

        Color[] colorsBear = new Color[3]{
            new Color(1,0,0),
            new Color(1,212.0f / 255.0f,0),
            new Color(1,0,110.0f / 255.0f),
        };

        Color[] colorsBull = new Color[3]{
            new Color(1.0f,0,238 / 255.0f),
            new Color(0,206 / 255.0f,229 / 255.0f),
            new Color(144 / 255.0f,0,1),
        };

        Color[] colors = null;
        switch (GlobalData.selectedGod)
        {
            case GlobalData.Gods.RHINO:
                colors = colorsRhino;
                break;
            case GlobalData.Gods.BEAR:
                colors = colorsBear;
                break;
            case GlobalData.Gods.BULL:
                colors = colorsBull;
                break;
        }

        for (int i = 0; i < maxCount; i++)
        {
            float endTime = 0;
            if (missing && (Random.Range(0, oneInXMissing)) == 0 && !missed && i > 2 && endTime < 50.0f)
            {
                missed = true;
            } else if (missed)
            {
                missed = false;
            }
            if (!missed)
            {
                GameObject bunny = null;
                if (bunz)
                {
                    bunny = bunz.bunnies[i];
                    bunny.SetActive(true);
                }
                else
                {
                    bunny = Instantiate(bunnyPrefab);
                    bunny.GetComponent<BunnyJump>().Startingu();
                    bunny.SetActive(true);
                }
                bunny.transform.parent = null;
                BunnyJump bunnyJumpS = bunny.GetComponent<BunnyJump>();
                bunnyJumpS.parentTransform = screen.transform;
                bunnyJumpS.startTime = i * beat;
                endTime = i * beat + expectedBunnyLifetime;
                bunnyJumpS.expectedBunnyLifetime = expectedBunnyLifetime;
                bunnyJumpS.beat = beat;
                bunnyJumpS.god = god;
                int randomColor = Random.Range(0, 3);
                while (randomColor == latestColor)
                {
                    randomColor = Random.Range(0, 3);
                }
                latestColor = randomColor;
                bunnyJumpS.color = colors[randomColor];
                bunnyJumpS.wiggleSpace = wiggleSpace;
                if (!randomSpawn)
                {
                    bunnyJumpS.angle = angles[i];
                }
                float scale = Random.Range(0.8f, 1.4f);
                bunny.GetComponent<Transform>().localScale = new Vector3(scale, scale, 1);
                bunnyJumpS.Init();
                bunnyCount++;
                bunnies.Add(bunnyJumpS);
            }
            if (endTime + beat > realDuration)
            {
                break;
            }
        }

        freq = 1.0f / audio.clip.frequency;

        startTime = AudioSettings.dspTime;

        minOffset = 0.0f;
        maxOffset = 0.0f;
    }