示例#1
0
    void SetColor(BoxColor.BColor color)
    {
        Color colorToBeApplied = Color.white;
        string tag = "";

        switch (color)
        {
            case BoxColor.BColor.Red:
                colorToBeApplied = Color.red;
                tag = "redblock";
                isClickable = false;
                break;
            case BoxColor.BColor.LightRed:
                colorToBeApplied = new Color32(255, 182, 193, 255); // pink
                tag = "lightredblock";
                isClickable = true;
                break;
            case BoxColor.BColor.Green:
                colorToBeApplied = Color.green;
                tag = "greenblock";
                isClickable = false;
                break;
            case BoxColor.BColor.Purple:
                colorToBeApplied = Color.blue;
                tag = "purpleblock";
                isClickable = true;
                break;
        }

        gameObject.tag = tag;

        gameObject.GetComponent<Renderer>().material.color = colorToBeApplied;
    }
    public void TriggerDamagePart()
    {
        BoxColor box      = Utilities.GetRandomEnum <BoxColor>();
        ItemPart itemPart = Utilities.GetRandomEnum <ItemPart>();

        DamagePart(itemPart, box);
    }
示例#3
0
    //Box Type has already been set in Prefabs
    //Set Values to get the Timings and Renderers right
    public void SetBeatInstanceValues(BoxColor color, double spawnedTime, double targetTime, Direction boxDir = Direction.None, bool debugValues = false)     // Vector3 spawnPos, float spawnHitDist
    {
        this.spawnedTime = spawnedTime;
        this.targetTime  = targetTime / 1000;

        boxColor = color;
        hitDir   = boxDir;

        SetColoredBeatValues(color);

        //Change Arrow Angle here as Hit Direction may change based on Color. (Left to Right, Right to Left)
        switch (hitDir)
        {
        case Direction.Left:
            markerR.transform.localEulerAngles = new Vector3(0, 0, 90);
            break;

        case Direction.Down:
            markerR.transform.localEulerAngles = new Vector3(0, 0, 180);
            break;

        case Direction.Right:
            markerR.transform.localEulerAngles = new Vector3(0, 0, 270);
            break;

        default:
            markerR.transform.localEulerAngles = new Vector3(0, 0, 0);
            break;
        }

        if (debugValues)
        {
            print(string.Format("Beat initialised. Transform is: {0}. Target Time is: {1}. Spawned Time is: {2}. Spawn Position is: {3} Box Color is: {4}", transform.position.z, this.targetTime, this.spawnedTime, spawnPos, boxColor));
        }
    }
示例#4
0
    /// <summary>
    /// Handles the errors start.
    /// </summary>
    void HandleErrorsStart()
    {
        _ai  = GetComponent <RobotAI>();
        _rcd = GetComponent <RobotCountToDeath>();

        if (_rcd == null)
        {
            Debug.LogError("ERROR! Set the RobotCountToDeath Script in the prefab.");
        }
        if (_ai == null)
        {
            Debug.LogError("ERROR! Set the RobotAI Script in the prefab.");
        }
        _rm = GetComponent <RobotMovement>();
        if (_rm == null)
        {
            Debug.LogError("ERROR! Set the RobotMovement Script in the prefab.");
        }
        _op = GetComponent <ObjectPicking>();
        if (_op == null)
        {
            Debug.LogError("ERROR! Set the ObjectPicking Script in the prefab.");
        }
        if (gameManager == null)
        {
            Debug.LogError("ERROR! Set the GameManager object when spawning.");
        }

        _gm           = gameManager.GetComponent <GameManager>();
        _colorOfRobot = robotColor;
    }
示例#5
0
 void AddScore(BoxColor box, BoxColor robotColor, bool userDecission)
 {
     if (userDecission && box == robotColor)
     {
         _gm.score += adderForHighScore;
     }
 }
 private void CheckInputs(float ir, float iy, float ib, float ig)
 {
     if (_canUseAxis)
     {
         BoxColor color = DRI.initialDoorColor;
         Debug.Log(color);
         bool used = true;
         if (color == BoxColor.RED && Mathf.Abs(ir) > 0.01f)
         {
             ExecuteClick();
         }
         else if (color == BoxColor.GREEN && Mathf.Abs(ig) > 0.01f)
         {
             ExecuteClick();
         }
         else if (color == BoxColor.YELLOW && Mathf.Abs(iy) > 0.01f)
         {
             ExecuteClick();
         }
         else if (color == BoxColor.BLUE && Mathf.Abs(ib) > 0.01f)
         {
             ExecuteClick();
         }
         else
         {
             used = false;
         }
         if (used)
         {
             _canUseAxis = false; StartCoroutine(StartCanInput());
         }
     }
 }
示例#7
0
    /// <summary>
    /// Checkes all the actions for user's decissions and also
    /// substracts to the RobotCountToTeacher (currently: 'RobotCountToDeath.cs')
    /// </summary>
    /// <param name="box"></param>
    /// <param name="right"></param>
    void HandleIfTheUserIsRight(BoxColor box, bool right)
    {
        if (right && box != _colorOfRobot)
        {
            SoundManager.instance.PlayRobotFail(GetComponent <AudioSource>());
            _gm.LessHealth();
            if (_substractWhenUserSaysRightAndRobotWrong)
            {
                _rcd.SubstractOne();
            }
            return;
        }

        if (box == _colorOfRobot && !right)
        {
            SoundManager.instance.PlayRobotFail(GetComponent <AudioSource>());
            _gm.LessHealth();
            return;
        }

        if (right && box == _colorOfRobot)
        {
            _rcd.SubstractOne();
            return;
        }
        Debug.LogWarning("Entered Nothing: " + box + " " + right);
        return;
    }
示例#8
0
    /// <summary>
    /// Learn with the following information: If the box that he gave is right or not.
    /// </summary>
    /// <param name="decider">How it will change the percentages</param>
    /// <param name="box" type="BoxColor">The box color that he dropped</param>
    /// <param name="right" type="bool">If the decission was right or not</param>
    public void Learn(float decider, BoxColor box, bool right)
    {
        int boxColor = (int)box;

        if (boxColor >= probs.Length)
        {
            return;
        }

        if (right)
        {
            for (int i = 0; i < probs.Length; i++)
            {
                if (i == boxColor)
                {
                    probs[i] += decider;
                    probs[i]  = Mathf.Clamp(probs[i], 0.0f, 1.0f);
                }
                else
                {
                    probs[i] -= decider;
                    probs[i]  = Mathf.Clamp(probs[i], 0, 1);
                }
            }
        }
        //  Debug.Log("PROBABILIDADES: " + probs[0] + " " + probs[1] + " " + probs[2] + " " + probs[3]);
    }
示例#9
0
 void AddScore(BoxColor box, BoxColor robotColor, bool userDecission)
 {
     if (userDecission && box == robotColor)
     {
         _gm.score += 100;
     }
 }
示例#10
0
    /// <summary>
    /// Learn with the following information: If the box that he gave is right or not.
    /// </summary>
    /// <param name="decider">How it will change the percentages</param>
    /// <param name="box" type="BoxColor">The box color that he dropped</param>
    /// <param name="right" type="bool">If the decission was right or not</param>
    public void Learn(float decider, BoxColor box, bool right)
    {
        int boxColor = (int)box;

        if (boxColor >= probs.Length)
        {
            return;
        }

        if (right)
        {
            for (int i = 0; i < probs.Length; i++)
            {
                if (i == boxColor)
                {
                    probs[i] += decider;
                    probs[i]  = Mathf.Clamp(probs[i], 0.0f, 1.0f);
                }
                else
                {
                    probs[i] -= decider;
                    probs[i]  = Mathf.Clamp(probs[i], 0, 1);
                }
            }
        }
    }
示例#11
0
    public void ChangeGloveColor()
    {
        if (gm.gameState == GameState.OnPlay)
        {
            switch (gloveColor)
            {
            case BoxColor.Red:
                gloveColor = BoxColor.Yellow;                         //Alternate between Yellow and Red
                r.material = gm.gloveMats[3];
                break;

            case BoxColor.Blue:
                gloveColor = BoxColor.Green;                         //Alternate between Green and Blue
                r.material = gm.gloveMats[2];
                break;

            case BoxColor.Green:
                gloveColor = BoxColor.Blue;                         //Alternate between Green and Blue
                r.material = gm.gloveMats[1];
                break;

            case BoxColor.Yellow:
                gloveColor = BoxColor.Red;                         //Alternate between Yellow and Red
                r.material = gm.gloveMats[0];
                break;
            }
        }
    }
示例#12
0
    /// <summary>
    /// Randoms the color of the box.
    /// </summary>
    /// <returns>The box color.</returns>
    public BoxColor RandomBoxColor()
    {
        int      r = Random.Range(0, 4);
        BoxColor c = (BoxColor)r;

        // Debug.Log(r + " " + c);
        return(c);
    }
示例#13
0
    void SetColoredBeatValues(BoxColor color)
    {
        //Left 90 degrees
        switch (color)
        {
        case BoxColor.Red:
            xOffset = -xOffsetRef;
            //if (hitDir == Direction.Left) hitDir = Direction.Right; //Not Needed as Default for Horizontal is Direction.Right

            MaterialUtils.ChangeMaterialColor(beatMat, gm.diffuseColors[0]);
            MaterialUtils.ChangeMaterialEmission(beatMat, gm.emissiveColors[0], gm.emissiveIntensities[0]);

            MaterialUtils.ChangeMaterialColor(markerMat, gm.diffuseColors[0]);
            MaterialUtils.ChangeMaterialEmission(markerMat, gm.emissiveColors[0], gm.emissiveIntensities[0]);
            break;

        case BoxColor.Yellow:
            xOffset = -xOffsetRef;
            //if (hitDir == Direction.Left) hitDir = Direction.Right; //Not Needed as Default for Horizontal is Direction.Right

            MaterialUtils.ChangeMaterialColor(beatMat, gm.diffuseColors[3]);
            MaterialUtils.ChangeMaterialEmission(beatMat, gm.emissiveColors[3], gm.emissiveIntensities[3]);

            MaterialUtils.ChangeMaterialColor(markerMat, gm.diffuseColors[3]);
            MaterialUtils.ChangeMaterialEmission(markerMat, gm.emissiveColors[3], gm.emissiveIntensities[3]);
            break;

        case BoxColor.Blue:
            xOffset = xOffsetRef;
            if (hitDir == Direction.Right)
            {
                hitDir = Direction.Left;
            }

            MaterialUtils.ChangeMaterialColor(beatMat, gm.diffuseColors[1]);
            MaterialUtils.ChangeMaterialEmission(beatMat, gm.emissiveColors[1], gm.emissiveIntensities[1]);

            MaterialUtils.ChangeMaterialColor(markerMat, gm.diffuseColors[1]);
            MaterialUtils.ChangeMaterialEmission(markerMat, gm.emissiveColors[1], gm.emissiveIntensities[1]);


            break;

        case BoxColor.Green:
            xOffset = xOffsetRef;
            if (hitDir == Direction.Right)
            {
                hitDir = Direction.Left;
            }

            MaterialUtils.ChangeMaterialColor(beatMat, gm.diffuseColors[2]);
            MaterialUtils.ChangeMaterialEmission(beatMat, gm.emissiveColors[2], gm.emissiveIntensities[2]);

            MaterialUtils.ChangeMaterialColor(markerMat, gm.diffuseColors[2]);
            MaterialUtils.ChangeMaterialEmission(markerMat, gm.emissiveColors[2], gm.emissiveIntensities[2]);
            break;
        }
    }
示例#14
0
        private void UpdateModel()
        {
            // If no model is set, create an internal model and copy the
            // axes/series/properties from the WPF objects to the internal model
            if (Model == null)
            {
                // Create an internal model
                if (internalModel == null)
                {
                    internalModel = new PlotModel();
                }

                // Transfer axes, series and properties from
                // the WPF dependency objects to the internal model
                if (Series != null)
                {
                    internalModel.Series.Clear();
                    foreach (var s in Series)
                    {
                        internalModel.Series.Add(s.CreateModel());
                    }
                }
                if (Axes != null && Axes.Count > 0)
                {
                    internalModel.Axes.Clear();

                    foreach (var a in Axes)
                    {
                        a.UpdateModelProperties();
                        internalModel.Axes.Add(a.ModelAxis);
                    }
                }

                if (PlotMargins.HasValue)
                {
                    internalModel.PlotMargins = new OxyThickness(
                        PlotMargins.Value.Left, PlotMargins.Value.Top,
                        PlotMargins.Value.Right, PlotMargins.Value.Bottom);
                }

                // Box around the plot area
                internalModel.BoxColor     = BoxColor.ToOxyColor();
                internalModel.BoxThickness = BoxThickness;

                internalModel.LegendPosition          = LegendPosition;
                internalModel.IsLegendOutsidePlotArea = IsLegendOutsidePlotArea;
            }
            else
            {
                internalModel = Model;
            }

            internalModel.UpdateData();
        }
示例#15
0
 /// <summary>
 /// Finds the button depending on the color you pass.
 /// </summary>
 /// <returns>The button.</returns>
 /// <param name="c">C.</param>
 GameObject FindButton(BoxColor c)
 {
     for (int i = 0; i < Buttons.Length; i++)
     {
         if (Buttons[i].GetComponent <DoorRobotInteraction>().CurrentColor() == c)
         {
             return(Buttons[i]);
         }
     }
     Debug.LogError("Color not found for FindButton(), please, check if you passed the right enum.");
     return(null);
 }
示例#16
0
 public void SetGloveToDefaultColors()
 {
     if (isLeft)
     {
         gloveColor = BoxColor.Red;
         r.material = gm.gloveMats[0];
     }
     else
     {
         gloveColor = BoxColor.Blue;
         r.material = gm.gloveMats[1];
     }
 }
    private void DamagePart(ItemPart itemPart, BoxColor box)
    {
        Item item;

        switch (itemPart)
        {
        case ItemPart.Battery:
            item = _itemBattery;
            break;

        case ItemPart.CircuitBoard:
            item = _itemCircuitBoard;
            break;

        case ItemPart.Gear:
            item = _itemGear;
            break;

        default:
            item = _itemBattery;
            break;
        }

        BoxContainer boxContainer;

        switch (box)
        {
        case BoxColor.Red:
            boxContainer = redBox;
            break;

        case BoxColor.Blue:
            boxContainer = blueBox;
            break;

        case BoxColor.Green:
            boxContainer = redBox;
            break;

        default:
            boxContainer = redBox;
            break;
        }

        bool success = _bubble.TriggerBubble(boxContainer.boxColor, item.itemIcon);

        if (success)
        {
            boxContainer.AddRequiredItemtoBox(item);
        }
    }
示例#18
0
 /// <summary>
 /// Instantiates a random robot.
 /// </summary>
 IEnumerator InstantiateRandomRobot()
 {
     while (true)
     {
         GameObject robot = (GameObject)Instantiate(robotPrefab);
         robot.transform.position = SpawnFromTheCenter();
         BoxColor       r  = RandomBoxColor();
         RobotBehaviour rb = robot.GetComponent <RobotBehaviour>();
         if (rb == null)
         {
             Debug.LogError("Error, no robot behaviour available");
         }
         waitSecondsForRobotSpawn -= timeSubstractorRobot;
         waitSecondsForRobotSpawn  = Mathf.Clamp(waitSecondsForRobotSpawn, minimumRobotSpawn, 100);
         yield return(new WaitForSeconds(waitSecondsForRobotSpawn));
     }
 }
示例#19
0
    void SetColor(BoxColor.BColor color)
    {
        Color colorToBeApplied = Color.white;

        switch (color)
        {
            case BoxColor.BColor.Red:
                colorToBeApplied = Color.red;
                break;
            case BoxColor.BColor.Green:
                colorToBeApplied = Color.green;
                break;
            case BoxColor.BColor.Purple:
                colorToBeApplied = Color.blue;
                break;
        }

        gameObject.GetComponent<Renderer>().sharedMaterial.color = colorToBeApplied;
    }
示例#20
0
        public Box Get(BoxColor color)
        {
            if (_boxes.ContainsKey(color))
            {
                return(_boxes[color]);
            }
            Box box = null;

            if (color == BoxColor.Black)
            {
                box = new BlackBox(20, 20);
            }
            else if (color == BoxColor.Blue)
            {
                box = new BlueBox(20, 20);
            }
            _boxes.Add(color, box);
            return(box);
        }
示例#21
0
        private void AddTileWithBox(int positionX, int positionY, BoxColor boxColor, TileType tileType)
        {
            var tile = new Tile
            {
                Id        = Guid.NewGuid(),
                TileType  = tileType,
                PositionX = positionX,
                PositionY = positionY
            };

            _tileManager.AddTile(tile);

            _boxManager.AddBox(new Box
            {
                Id        = Guid.NewGuid(),
                Color     = boxColor,
                TileItsOn = tile
            });
        }
示例#22
0
    /// <summary>
    /// Checkes all the actions for user's decissions
    /// </summary>
    /// <param name="box"></param>
    /// <param name="right"></param>
    void HandleIfTheUserIsRight(BoxColor box, bool right)
    {
        if (right && box != _colorOfRobot)
        {
            SoundManager.instance.PlayRobotFail(GetComponent <AudioSource>());
            _gm.LessHealth();
        }

        if (box == _colorOfRobot && !right)
        {
            SoundManager.instance.PlayRobotFail(GetComponent <AudioSource>());
            _gm.LessHealth();
        }

        if (right && box == _colorOfRobot)
        {
            _rcd.SubstractOne();
        }
    }
示例#23
0
 /// <summary>
 /// Returns a Button GameObject for Robot Info.
 /// </summary>
 /// <returns>The button to go.</returns>
 /// <param name="c">C.</param>
 public GameObject GiveDoor(BoxColor c)
 {
     return(FindButton(c));
 }
示例#24
0
 /// <summary>
 /// Sets the color.
 /// </summary>
 /// <param name="c">C.</param>
 public void SetColor(BoxColor c)
 {
     _colorOfRobot = c;
 }
示例#25
0
 public void SetColor(BoxColor c)
 {
     color = c;
     GetComponent <MeshRenderer>().materials[1].color = _gm.colors[(int)c];
 }
示例#26
0
 /// <summary>
 /// Sets the Box color.
 /// </summary>
 /// <param name="color">The color to set.</param>
 public void SetColor(BoxColor color)
 {
     this.color = color;
 }
示例#27
0
 public void ChangeColor(BoxColor c)
 {
     _currentDoorColor = c;
 }
示例#28
0
 void Start()
 {
     _currentDoorColor = initialDoorColor;
     gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
 }
示例#29
0
 /// <summary>
 /// Changes the wanted probability
 /// </summary>
 /// <param name="substractor">Substractor.</param>
 /// <param name="objective" type="BoxColor">Objective.</param>
 public void ChangeProb(BoxColor objective, float substractor = 0.0f, float adder = 0.0f)
 {
     probs[(int)objective] -= substractor;
     probs[(int)objective] += adder;
 }