Пример #1
0
 public void EatColor(avaliableColors colorToEat)
 {
     if (colorToEat == loadedTask.objectionItems[orbsEaten])
     {
         fishItems[orbsEaten].GetComponentInChildren <Image>().sprite = filledFishSprite;
         orbsEaten++;
     }
 }
Пример #2
0
    public void SetInk(avaliableColors newInk)
    {
        Color newColor = inkBox.colors[newInk];

        ink      = newInk;
        OrbColor = newColor;
        MeshRenderer meshRenderer = gameObject.GetComponent <MeshRenderer>();

        meshRenderer.material.SetColor("_EmissionColor", newColor);
    }
Пример #3
0
    //private void FixedUpdate()
    //{
    //    if(!fallenInLine){
    //        if (timeToFallInLine > 0)
    //        {
    //            timeToFallInLine -= Time.fixedDeltaTime;
    //        }else if(frontFish != null)
    //        {
    //            GetComponent<HingeJoint>().connectedBody = frontFish.GetComponent<Rigidbody>();
    //            GetComponent<Collider>().enabled = true;
    //            fallenInLine = true;
    //        }
    //    }
    //}

    public void SetInk(avaliableColors newInk)
    {
        inkBox = FindObjectOfType <InkBox>();
        ink    = newInk;
        Color newColor = inkBox.colors[newInk];

        GetComponent <Light>().color = newColor;
        MeshRenderer[] emittingMeshes = GetComponentsInChildren <MeshRenderer>();
        foreach (MeshRenderer mesh in emittingMeshes)
        {
            if (mesh.gameObject.CompareTag("Emitting"))
            {
                mesh.material.SetColor("_EmissionColor", newColor);
            }
        }
    }
Пример #4
0
    public avaliableColors MixColors(avaliableColors colorA, avaliableColors colorB)
    {
        if (colorA == colorB)
        {
            return(colorA);
        }
        else
        {
            List <avaliableColors> colorsToMix = new List <avaliableColors>();
            colorsToMix.Add(colorA);
            colorsToMix.Add(colorB);

            if (colorsToMix.Contains(avaliableColors.RED))
            {
                colorsToMix.Remove(avaliableColors.RED);
                switch (colorsToMix[0])
                {
                case avaliableColors.BLUE:
                    return(avaliableColors.PURPLE);

                case avaliableColors.YELLOW:
                    return(avaliableColors.ORANGE);

                default:
                    return(avaliableColors.WHITE);
                }
            }
            if (colorsToMix.Contains(avaliableColors.BLUE))
            {
                colorsToMix.Remove(avaliableColors.BLUE);
                switch (colorsToMix[0])
                {
                case avaliableColors.YELLOW:
                    return(avaliableColors.GREEN);

                default:
                    return(avaliableColors.WHITE);
                }
            }
            else
            {
                return(avaliableColors.WHITE);
            }
        }
    }
Пример #5
0
    private void BuildUpTask(Task task)
    {
        loadedTask = task;
        float width         = emptyFishPrefab.GetComponentInChildren <RectTransform>().rect.width;
        int   space         = 35;
        float joinedWidth   = width + space;
        int   numberOfTasks = task.objectionItems.Count;
        float anchorLeft    = -(numberOfTasks % 2 == 0 ? numberOfTasks / 2 * joinedWidth : numberOfTasks / 2 * joinedWidth - space / 2);

        for (int i = 0; i < numberOfTasks; i++)
        {
            GameObject fishItem = Instantiate(emptyFishPrefab, gameObject.transform);
            fishItems.Add(fishItem);
            fishItem.transform.Translate(new Vector3(anchorLeft + i * (joinedWidth), 0.0f, 0.0f));
            avaliableColors color    = task.objectionItems[i];
            Color           newColor = (inkBox.colors[color]);
            newColor.a = 0.60f;
            fishItem.GetComponentInChildren <Image>().color = newColor;
        }
    }
Пример #6
0
    private void AddSubfish(avaliableColors fishColor)
    {
        GameObject newSubfish;

        if (closestSubfish != null)
        {
            newSubfish = Instantiate(subfishPrefab, closestSubfish.transform.position + transform.right * 0.5f, closestSubfish.transform.rotation);
            newSubfish.GetComponent <SubfishController>().SetNewFrontFish(closestSubfish);
            closestSubfish = newSubfish;
        }
        else
        {
            newSubfish = Instantiate(subfishPrefab, transform.position + transform.right * 1.1f, transform.rotation);
            newSubfish.GetComponent <SubfishController>().SetNewFrontFish(this.gameObject);
            closestSubfish = newSubfish;
        }

        subfishes.Add(newSubfish);
        UpdateSubfishes();
        SubfishController newSubfishController = newSubfish.GetComponent <SubfishController>();

        newSubfishController.SetInk(fishColor);
    }