Ejemplo n.º 1
0
 void EnergyLogic()
 {
     if (PlayerController.State == PlayerController.PlayerState.Energy)
     {
         if (progress < 1)
         {
             progress += speed;
             if (progress > 0.1f)
             {
                 PlayerPower.Instance.ChangePower(power);
                 GameObject textObject = Instantiate(TextPop);
                 textObject.transform.position = transform.position;
                 TextPop pop = textObject.GetComponent <TextPop>();
                 pop.color    = Color.yellow;
                 pop.duration = 0.5f;
                 pop.text     = "Gulp";
                 pop.speed    = 0.1f;
                 audioSource.PlayOneShot(gulp[Random.Range(0, gulp.Count)], 1f);
             }
         }
         else
         {
             progress = 0;
             PlayerController.State = PlayerController.PlayerState.Walking;
         }
     }
 }
Ejemplo n.º 2
0
 void SunLogic()
 {
     if (PlayerController.State == PlayerController.PlayerState.Sun)
     {
         if (progress < 1)
         {
             progress += speed;
             if (progress > 0.1f)
             {
                 PlayerPower.Instance.ChangePower(power);
                 GameObject textObject = Instantiate(TextPop);
                 textObject.transform.position = transform.position;
                 TextPop pop = textObject.GetComponent <TextPop>();
                 pop.color    = Color.yellow;
                 pop.duration = 3f;
                 pop.text     = "PRAISE THE SUN";
                 pop.speed    = 0.01f;
             }
         }
         else
         {
             progress = 0;
             PlayerController.State = PlayerController.PlayerState.Walking;
         }
     }
 }
Ejemplo n.º 3
0
    public static TextMesh Pop <T>(T content, Color color, Vector3 position, int fontSize = -1, float time = 0f)
    {
        GameObject gameObject = new GameObject("Text Pop", typeof(TextMesh), typeof(TextPop));

        gameObject.transform.position = position;
        TextPop pop = gameObject.GetComponent <TextPop>();

        pop.Setup((fontSize > 0 ? fontSize : defualtFontSize) / 2f);
        DelayEvent.Create(time > 0 ? time : defualtPopTime, pop.DestorySelf);
        return(ConfigTextMesh(gameObject.GetComponent <TextMesh>(), content, color, fontSize));
    }
Ejemplo n.º 4
0
 void Ring()
 {
     if (isOn)
     {
         audioSource.PlayOneShot(ring, 0.5f);
         GameObject textObject = Instantiate(TextPop);
         textObject.transform.position = transform.position;
         TextPop pop = textObject.GetComponent <TextPop>();
         pop.color    = Color.yellow;
         pop.duration = 0.5f;
         pop.text     = "Ring";
         pop.speed    = 0.1f;
     }
 }
        public void NuevaGeneracion(int numNuevoCore = 0, bool crossoverNewCore = false)
        {
            int finalCount = TextPop.Count + numNuevoCore;

            if (finalCount <= 0)
            {
                return;
            }

            if (TextPop.Count > 0)
            {
                CalcularAjuste();
                TextPop.Sort(CompareCore);
            }
            nuevoTextoPop.Clear();

            for (int i = 0; i < TextPop.Count; i++)
            {
                if (i < Optimizado && i < TextPop.Count)
                {
                    nuevoTextoPop.Add(TextPop[i]);
                }
                else if (i < TextPop.Count || crossoverNewCore)
                {
                    CoreText <T> par1 = SelectPar();
                    CoreText <T> par2 = SelectPar();

                    CoreText <T> child = par1.Crossover(par2);

                    child.Mutacion(MutationRate);

                    nuevoTextoPop.Add(child);
                }
                else
                {
                    nuevoTextoPop.Add(new CoreText <T>(CoreSize, random, getRandomGene, FuncAjuste, shouldInitGenes: true));
                }
            }

            List <CoreText <T> > tmpList = TextPop;

            TextPop       = nuevoTextoPop;
            nuevoTextoPop = tmpList;

            Generacion++;
        }
Ejemplo n.º 6
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E) && collider.IsTouching(player))
     {
         if (OvenController.Instance.Heat > 0.5f)
         {
             PlayerController.State = PlayerController.PlayerState.Coffee;
             audioSource.PlayOneShot(makingSound[Random.Range(0, makingSound.Count)], 1f);
         }
         else
         {
             GameObject textObject = Instantiate(TextPop);
             textObject.transform.position = transform.position;
             TextPop pop = textObject.GetComponent <TextPop>();
             pop.color    = Color.cyan;
             pop.duration = 3f;
             pop.text     = "Kettle too cold\n start the kettle";
             pop.size     = 17;
             pop.speed    = 0.01f;
         }
     }
     coffeProgress.SetStatus(progress);
 }
Ejemplo n.º 7
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E) && collider.IsTouching(player))
     {
         float    timeDialiation  = realTimeDuration / GameStateController.Instance.GameDuration;
         DateTime realCurrentTime = new DateTime().AddSeconds((Time.time - GameStateController.Instance.GameStartTime) * timeDialiation);
         if (realCurrentTime.Hour < 12)
         {
             PlayerController.State = PlayerController.PlayerState.Sun;
         }
         else
         {
             GameObject textObject = Instantiate(TextPop);
             textObject.transform.position = transform.position;
             TextPop pop = textObject.GetComponent <TextPop>();
             pop.color    = Color.cyan;
             pop.duration = 3f;
             pop.text     = "No Sun";
             pop.size     = 17;
             pop.speed    = 0.01f;
         }
     }
     SunProgress.SetStatus(progress);
 }
Ejemplo n.º 8
0
 // Update is called once per frame
 void Update()
 {
     if (PlayerController.State == PlayerController.PlayerState.Walking && Input.GetKeyDown(KeyCode.E) && collider.IsTouching(player))
     {
         if (ammount > 0)
         {
             PlayerController.State = PlayerController.PlayerState.Energy;
             audioSource.PlayOneShot(makingSound[Random.Range(0, makingSound.Count)], 1f);
             ammount--;
         }
         else
         {
             GameObject textObject = Instantiate(TextPop);
             textObject.transform.position = transform.position;
             TextPop pop = textObject.GetComponent <TextPop>();
             pop.color    = Color.cyan;
             pop.duration = 3f;
             pop.text     = "Out of energy drinks";
             pop.size     = 17;
             pop.speed    = 0.01f;
         }
     }
     EnergyProgress.SetStatus(progress);
 }
Ejemplo n.º 9
0
 // Update is called once per frame
 void Update()
 {
     if (GameStateController.Instance.CurrentState == GameStateController.GameStates.Tutorial && Input.GetKeyDown(KeyCode.E) && collider.IsTouching(player))
     {
         GameObject textObject = Instantiate(TextPop);
         textObject.transform.position = transform.position;
         TextPop pop = textObject.GetComponent <TextPop>();
         pop.color    = Color.white;
         pop.duration = 3f;
         pop.text     = "JAM NOT YET STARTED\n MAKE COFFE TO START JAM";
         pop.speed    = 0.01f;
         return;
     }
     if (GameStateController.Instance.CurrentState != GameStateController.GameStates.InGame)
     {
         return;
     }
     if (PlayerController.State == PlayerController.PlayerState.Walking && Input.GetKey(KeyCode.E) && collider.IsTouching(player))
     {
         PlayerController.State = PlayerController.PlayerState.Programming;
         console.SetActive(true);
     }
     if (PlayerController.State == PlayerController.PlayerState.Programming && (Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.Tab)))
     {
         console.SetActive(false);
         foreach (Transform child in console.transform)
         {
             if (child.tag == "Letter")
             {
                 Destroy(child.gameObject);
             }
         }
         ScoreController.Instance.DecreseMultiplier();
         PlayerController.State = PlayerController.PlayerState.Walking;
     }
 }
Ejemplo n.º 10
0
    public void CreateTextPop(Vector3 worldPosition, string message, Color col)
    {
        TextPop text = new TextPop(message, worldPosition, col);

        textPopList.Enqueue(text);
    }