Example #1
0
    /*			functions related to setting and updating the cured bars			*/

    //sets the current values of the fillers;
    void curValsSetter(FaceScript one, FaceScript two, FaceScript three, float av, float bv, float cv)
    {
        one.Value   = av;
        two.Value   = bv;
        three.Value = cv;
        three.Val   = cv;
    }
Example #2
0
    void Start()
    {
        Time.timeScale = 1;

        //attach components
        _char = GetComponent <CharacterController>();
        _absoluteTransform = Camera.main.transform;
        _sprite            = transform.Find("Sprite");
        _legs         = _sprite.Find("Legs").GetComponent <LegsScript>();
        _face         = _sprite.Find("Face").GetComponent <FaceScript>();
        _dialogue     = GameObject.FindGameObjectWithTag("Dialogue").GetComponent <DialogueScript>();
        _faceStartPos = _face.transform.localPosition;
        _save         = GetComponent <SavePosition>();

        //set init vars
        _startPosSprite = _sprite.localPosition;

        float savedPos = _save.Load();

        if (savedPos != 0)
        {
            Vector3 newPos = transform.position;
            newPos.x           = savedPos;
            transform.position = newPos;
        }
    }
    void Update()
    {
        if(gameObject.name == "MiniCube")
        {
            GameObject.Find("MiniCube").transform.Rotate(1,1,1);
        }
        if(gameObject.name == "MiniCube" && CanColor)
        {
            while(counter < 54)
            {
                ColorId = Faces[counter].GetComponent<FaceScript>();
                ColorId.ActualColor = Mathf.FloorToInt(Random.Range(1,5));
                counter += 1;
            }
            if(counter >= 53)
            {
                CanColor = false;
            }
        }
        CountTo += Time.deltaTime;
        if(gameObject.name == "CubeM")
        {

            FaceScript baby;
            baby = gameObject.GetComponent<FaceScript>();
            if(CountTo > 10f)
            {
                CountTo = 0;
                try
                {
                    Faces[Random.Range(0,54)].renderer.material = Resources.Load("CubeDefault", typeof(Material)) as Material;
                }
                catch
                {

                }
            }
            while(loving < 54)
            {
                if(VerifyColors(loving, baby))
                {
                    amorzinho[loving] = true;
                }
                loving ++;
                for(int i = 0; i < 54; i++)
                {
                    if(amorzinho[i])
                    {
                        ContinueTry = false;
                    }
                }
                if(loving >= 53 && ContinueTry)
                {
                    loving = 0;
                }
            }
        }
    }
Example #4
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.GetComponent <FaceScript> () != null)
     {
         interceptedObject = other.GetComponent <FaceScript> ();
         if (interceptedObject.color != "green")
         {
             Destroy(other.gameObject);
         }
     }
 }
Example #5
0
 //To set up all the objects and the maxVals if the ydon't vary later;
 public void dayOne(GameBuilder1 world, Initializer init)
 {
     a           = GameObject.Find("TubeL").GetComponent <FaceScript> ();
     b           = GameObject.Find("TubeR").GetComponent <FaceScript> ();
     fnd         = GameObject.Find("FundsBar").GetComponent <FaceScript> ();
     maxValA     = (float)world.retDay(1).get("totalTrtA");
     maxValB     = (float)world.retDay(1).get("totalTrtB");
     maxValFunds = (float)init.getParam("fund");
     maxValSetter(a, b, maxValA, maxValB);
     fnd.MaxValue = maxValFunds;
     curValsSetter(a, b, fnd,
                   (float)world.retDay(1).get("totalA"),
                   (float)world.retDay(1).get("totalB"),
                   (float)maxValFunds);
 }
Example #6
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.GetComponent <BoardBarrier>() == null && other.gameObject.GetComponent <ShapeIdentifier>() == null && other.gameObject.GetComponent <Blockade>() == null)        //Only collect polyfaces.
     {
         polyFaceScript = other.GetComponent <FaceScript>();
         if (polyFaceScript.strength == 1)
         {
             Destroy(other.gameObject);
             Debug.Log("Destroying GameObject!");
         }
         else
         {
             polyFaceScript.strength -= (strength + 1);
         }
         if (strength == 0)
         {
             Destroy(gameObject);
         }
     }
 }
 void Start()
 {
     rb       = GetComponent <Rigidbody2D>();
     _emotion = GetComponentInChildren <FaceScript>();
 }
Example #8
0
 //needed for faceScript which calculates the relative ratios of
 //	cur. vals depending on the max. vals;
 void maxValSetter(FaceScript one, FaceScript two, float av, float bv)
 {
     one.MaxValue = av;
     two.MaxValue = bv;
 }
 void ChangingColors(FaceScript lol)
 {
     lol.ActualColor = Mathf.FloorToInt(Random.Range(1,5));
 }
 bool VerifyColors(int i, FaceScript lol)
 {
     lol = Faces[i].GetComponent<FaceScript>();
     if(lol.ActualColor == ColorId.ActualColor)
     {
         return true;
     }
     else
     {
         return false;
     }
 }