Inheritance: ScriptableObject
Esempio n. 1
0
    void Start()
    {
        controller      = GetComponent <Controller2D>();
        PV              = GetComponent <PhotonView>();
        playerMove      = GetComponent <NewPlayerMovent>();
        inputController = GetComponent <InputController>();
        buildPC         = Resources.Load <BoolVariable>("BuildPC");

        rightDir = true;
        leftDir  = false;

        menuCustom = false;

        if (SceneManager.GetActiveScene().name == "HUB" || !PhotonNetwork.InRoom)
        {
            menuCustom = true;
        }

        if (SceneManager.GetActiveScene().name == "Customiza" || SceneManager.GetActiveScene().name == "Cabelo" || SceneManager.GetActiveScene().name == "Shirt" || SceneManager.GetActiveScene().name == "Tenis")
        {
            desativaCanvas = true;
        }

        CheckHUD();
    }
    public void CreateNew()
    {
        switch (tipo)
        {
        case TipoVar.Int:
            IntVariable intVar = Instantiate(Manager.Instance.intVariablePrefab, new Vector3(999, 999, 999), Quaternion.identity);
            intVar.nombre     = nombreInput.text;
            intVar.proteccion = NivelDeProteccion;
            c.variablesInt.Add(intVar);
            p.AddVariable("int");
            break;

        case TipoVar.Float:
            FloatVariable floatVar = Instantiate(Manager.Instance.floatVariablePrefab, new Vector3(999, 999, 999), Quaternion.identity);
            floatVar.nombre     = nombreInput.text;
            floatVar.proteccion = NivelDeProteccion;
            c.variablesFloat.Add(floatVar);
            p.AddVariable("float");
            break;

        case TipoVar.Boolean:
            BoolVariable booleanVar = Instantiate(Manager.Instance.boolVariablePrefab, new Vector3(999, 999, 999), Quaternion.identity);
            booleanVar.nombre     = nombreInput.text;
            booleanVar.proteccion = NivelDeProteccion;
            c.variablesBoolean.Add(booleanVar);
            p.AddVariable("bool");
            break;
        }
        c.NumberVariables++;
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        _renderer = GetComponent <Renderer>();

        if (toggleState == null)
        {
            ToggleSwitch ts = GetComponent <ToggleSwitch>();
            if (ts != null)
            {
                toggleState = ts.toggleState;
            }
            ToggleMovingPlatform tmp = GetComponent <ToggleMovingPlatform>();
            if (tmp != null)
            {
                toggleState = tmp.toggleState;
            }
        }
        if (toggleState == null)
        {
            return;
        }
        if (toggleState.RuntimeValue)
        {
            _renderer.material.color = OnColor;
        }
        else
        {
            _renderer.material.color = OffColor;
        }
    }
        protected override void Init()
        {
            base.Init();
            BoolVariable boolVar = GetComponent <EntityController>().touch;

            GetComponent <AnimationBool>().param = boolVar;
        }
Esempio n. 5
0
    void Start()
    {
        PV            = GetComponent <PhotonView>();
        textoAtivo    = Resources.Load <BoolVariable>("TextoAtivo");
        desativaPower = Resources.Load <BoolVariable>("DesativaPower");
        buildPC       = Resources.Load <BoolVariable>("BuildPC");
        dogScript     = GetComponent <DogController>();

        switch (GameManager.sceneAtual)
        {
        case SceneType.Coleta:
        case SceneType.Corrida:
            state = State.Atirar;
            break;

        case SceneType.Futebol:
            state = State.Chutar;
            break;

        case SceneType.Moto:
            state = State.Manobra;
            break;

        case SceneType.Volei:
            state = State.Cortar;
            break;

        default:
            break;
        }
    }
        /// <summary>
        /// Handle the raycastHits to check if one of them touch something
        /// </summary>
        /// <param name="hits">The list of RaycastHits to check</param>
        /// <param name="isOver">the BoolVariable to set if something got hit</param>
        /// <param name="hitPoint">The Hit Point where the raycast collide</param>
        /// <param name="objectOver">The GameEvent to raise with the transform of the hit</param>
        private void HandleOver(List <RaycastHit> hits, BoolVariable isOver, RaycastHitVariable hitPoint, GameEventTransform objectOver)
        {
            //If nothing is hit, we set the hasHit value to false
            if (hits.Count == 0)
            {
                isOver.SetValue(false);
            }
            else
            {
                foreach (var hit in hits)
                {
                    // If something is hit and is not from the Exclusion layer, we set everything and return
                    if (hit.collider.gameObject.layer != pointerRayCast.ExclusionLayer)
                    {
                        var hitTransform = hit.collider.transform;

                        isOver.SetValue(true);

                        hitPoint.SetValue(hit);
                        objectOver.Raise(hitTransform);
                        return;
                    }
                    //If the only hit was on the exclusion layer, we set the hasHit value to false
                    else
                    {
                        isOver.SetValue(false);
                    }
                }
            }
        }
Esempio n. 7
0
        public void AddVariableOnContextMenuItem(MenuButton sender)
        {
            switch (_addVariableStep)
            {
            case AddVariableSteps.SetType:
            {
                if (!_addVariableTypeMenuButtons.ContainsKey(sender))
                {
                    return;
                }

                _addVariableType = _addVariableTypeMenuButtons[sender];
                _contextMenu.gameObject.SetActive(false);

                IVariable newVariable = null;

                if (_addVariableType == ValueType.Bool)
                {
                    newVariable = new BoolVariable();
                }
                else
                {
                    newVariable = new FloatVariable();
                }

                _addVariableStep = AddVariableSteps.SetName;
                _mainController.SetVariableNameFromDialog(newVariable);
            }
            break;
            }
        }
        public void Setup()
        {
            stream = new BitStream();
            BoolVariable variable = new BoolVariable(0, "boolVar");

            serializer = new BoolVariableSerializer(variable);
        }
Esempio n. 9
0
        //EMPTY
        #region PUBLIC_METHODS
        #endregion


        #region PRIVATE_METHODS
        /// <summary>
        /// Check if the pointer is touching the UI
        /// </summary>
        /// <param name="isOver">If the Raycast is over something</param>
        /// <param name="pointerState">The current state of the pointer</param>
        /// <param name="pointer">The linerenderer to which the material is attached</param>
        /// <returns>The new state of the pointer</returns>
        private EPointerState CheckPointer(BoolVariable isOver, EPointerState pointerState, LineRenderer pointer, EHand hand)
        {
            Color on         = Color.white;
            Color off        = Color.white;
            Color selectable = Color.white;

            GetColor(hand, ref on, ref off, ref selectable);

            // If the pointer is supposed to be off
            if (pointerState == EPointerState.OFF)
            {
                pointer.material.color = off;
                return(EPointerState.OFF);
            }
            // If the pointer is not over something and it's state is not On
            else if (!isOver.Value && pointerState != EPointerState.ON)
            {
                pointer.material.color = on;
                return(EPointerState.ON);
            }
            // If the pointer is over something and it's state is not at Selectable
            else if (isOver.Value && pointerState != EPointerState.SELECTABLE)
            {
                pointer.material.color = selectable;
                return(EPointerState.SELECTABLE);
            }
            return(pointerState);
        }
Esempio n. 10
0
 public LowHealthPlayerSystem(HealthSystem HealthSystem, LowHealthPlayerSystemDefinition LowHealthPlayerSystemDefinition)
 {
     this.HealthSystemRef = HealthSystem;
     this.LowHealthPlayerSystemDefinition = LowHealthPlayerSystemDefinition;
     this.IsLowHealth = new BoolVariable(false, this.OnLowHealthStarted, this.OnLowHealthEnded);
     HealthSystem.RegisterOnHealthValueChangedEventListener(this.OnHealthValueChanged);
 }
Esempio n. 11
0
        // Start is called before the first frame update
        void Start()
        {
            faseComeca.Value = false;
            playerGanhou     = Resources.Load <BoolVariable>("PlayerGanhou");

            if (recordTime.Value != 0)
            {
                recordTimeText.enabled = true;
                float record = Mathf.Round(recordTime.Value * 100f) / 100f;

                if (record >= 60)
                {
                    recordMinutes = Mathf.RoundToInt(record / 60);
                    recordSeconds = record - (recordMinutes * 60);
                }

                else
                {
                    recordMinutes = 0;
                    recordSeconds = record;
                }

                recordTimeText.text = "Melhor Tempo:" + recordMinutes + "." + recordSeconds;
            }

            else
            {
                recordTimeText.enabled = false;
            }
        }
Esempio n. 12
0
    private void Start()
    {
        if (pv == null)
        {
            pv = gameObject.GetComponent <PhotonView>();
            pv.ObservedComponents = new List <Component>();
            pv.ObservedComponents.Add(this);
        }

        currentScene = SceneManager.GetActiveScene().name;
        playerGanhou = Resources.Load <BoolVariable>("PlayerGanhou");


        if (GameManager.historiaMode)
        {
            switch (currentScene)
            {
            default:
                old = SceneType.Corrida;                            //no código antigo tava falando pra mudar pra esse quando a cena não era a da moto e quando era a da moto, deixei aqui de forma a mudar fácil se n for pra ser assim
                break;
            }
        }


        pv = GetComponent <PhotonView>();


        if (pv.IsMine)
        {
            pv.RPC("ZeraPontuacao", RpcTarget.All);

            pv.Controller.SetScore(0);
        }
    }
        public override void Start()
        {
            base.Start();
            cam           = transform.parent.gameObject.transform.GetChild(0).gameObject;
            playerThings  = GetComponent <PlayerThings>();
            dogController = GetComponent <DogController>();

            hitCarro = Resources.Load <BoolVariable>("HitCarro");
            hitPipa  = Resources.Load <BoolVariable>("HitPipa");

            isCaixaDaguaSound = true;
            isBallKicked      = true;
            isShotRecived     = true;

            motoSpd = GetComponent <MotoChangeSpeed>();

            if (isVolei)
            {
                handVolei = GetComponent <HandVolei>();
            }

            if (isFut)
            {
                futebolPlayer = GetComponent <FutebolPlayer>();
            }
        }
Esempio n. 14
0
        public void Add_And_Get_Items()
        {
            const string var1Name = "var1name";
            const string var2Name = "var2name";
            const string var3Name = "var3name";

            var var1 = new IntVariable(1234);
            var var2 = new StringVariable("theValue");
            var var3 = new BoolVariable(true);

            var vg = new VariablesGroup
            {
                { var1Name, var1 },
                new KeyValuePair <string, IVariable>(var2Name, var2)
            };

            vg[var3Name] = var3;

            Assert.That(vg.Count, Is.EqualTo(3));
            Assert.That((int)vg[var1Name].GetValue() !, Is.EqualTo(1234));
            Assert.That((string)vg[var2Name].GetValue() !, Is.EqualTo("theValue"));
            Assert.That(vg.Keys.Count, Is.EqualTo(3));
            Assert.That(vg.ContainsKey(var1Name));
            Assert.That(vg.Values.Count, Is.EqualTo(3));
            Assert.That(vg.Values.Contains(var1));
            Assert.That(vg.Values.Contains(var2));
            Assert.That(vg.Values.Contains(var3));
            Assert.That(vg.ContainsKey(var2Name));
            Assert.That(vg.TryGetValue(var1Name + "False", out _), Is.False);
        }
Esempio n. 15
0
    public void Interact()
    {
        BoolVariable boolVariable = (BoolVariable)bc.GetBlackboardValue(blackboardEventName);

        boolVariable.value = !boolVariable.value;
        bc.TriggerEvent(blackboardEventName);
    }
Esempio n. 16
0
        private void SetupUIElement()
        {
            _controllersParameter = ControllersParametersVariable.Instance;
            _gazeParameter        = GazeParametersVariable.Instance;

            _interactionContainer = InteractionVariableContainer.Instance;
            _inputContainer       = InputVariableContainer.Instance;

            _rightIsClicking = _inputContainer.RightClickBoolean.Get("TriggerIsDown");
            _leftIsClicking  = _inputContainer.LeftClickBoolean.Get("TriggerIsDown");

            // If the controllers are not used, we cannot click on the slider, so we will fill the slider with the Over events
            if (!_controllersParameter.UseControllers && FillWithClick)
            {
                FillWithClick = false;
                Debug.Log("VRSF : UseController is set at false. The auto fill slider won't use the controller to fill but the gaze.");
            }

            // We initialize the _EventsDictionary
            InitializeEventsDictionaries();

            // We setup the ListenersDictionary
            _clickListenersDictionary = _uiSetup.CheckGameEventListenersPresence(_gameEventListenersContainer, _clickListenersDictionary, 6);
            _overListenersDictionary  = _uiSetup.CheckGameEventListenersPresence(_gameEventListenersContainer, _overListenersDictionary, 6);

            _clickListenersDictionary = _uiSetup.SetGameEventListeners(_clickListenersDictionary, _clickEventsDictionary, _gazeParameter.UseGaze);
            _overListenersDictionary  = _uiSetup.SetGameEventListeners(_overListenersDictionary, _overEventsDictionary, _gazeParameter.UseGaze);
        }
Esempio n. 17
0
 public ActionController(PieceVariable p, IInputGiver g, BoolVariable d)
 {
     _currentPiece = p;
     _giver        = g;
     _hardDrop     = d;
     SubscribeGiver();
 }
Esempio n. 18
0
        IEnumerator EnableBonus(BoolVariable variable)
        {
            variable.Value = true;
            yield return(new WaitForSeconds(_activeTime.Value));

            variable.Value = false;
        }
Esempio n. 19
0
        public AnimationController(NavMeshAgent agent, AnimatorPlayableObject animatorPlayableObject, Rigidbody rigidbody,
                                   Action OnRootMotionEnabled = null, Action OnRootMotionDisabled = null)
        {
            Agent = agent;
            AnimatorPlayableObject = animatorPlayableObject;
            Rigidbody = rigidbody;

            this.RootMotionEnabled = new BoolVariable(false,
                                                      () =>
            {
                this.OnRootMotionEnabled();
                if (OnRootMotionEnabled != null)
                {
                    OnRootMotionEnabled.Invoke();
                }
            },
                                                      () =>
            {
                this.OnRootMotionDisabled();
                if (OnRootMotionDisabled != null)
                {
                    OnRootMotionDisabled.Invoke();
                }
            });
        }
Esempio n. 20
0
 public StunningDamageDealerReceiverSystem(StunningDamageDealerReceiverSystemDefinition stunningDamageDealerReceiverSystemDefinition, HealthSystem healthSystem, Action OnStunningDamageDealerReceiverStartedAction = null,
                                           Action OnStunningDamageDealerReceiverEndedAction = null)
 {
     _stunningDamageDealerReceiverSystemDefinition = stunningDamageDealerReceiverSystemDefinition;
     HealthSystem   = healthSystem;
     this.isStunned = new BoolVariable(false, OnStunningDamageDealerReceiverStartedAction, OnStunningDamageDealerReceiverEndedAction);
 }
Esempio n. 21
0
 public ContextButton(VisualElement parent, string label, Action OnSelectionActionListener)
 {
     this.OnSelectionActionListener = OnSelectionActionListener;
     this.IsSelected = new BoolVariable(false, this.OnSelected, this.OnUnSelected);
     this.text       = label;
     parent.Add(this);
     this.RegisterCallback <MouseUpEvent>(this.OnClicked);
 }
Esempio n. 22
0
 private void Update()
 {
     if (variable == null)
     {
         variable = new BoolVariable();
     }
     toggle.isOn = variable.runtimeValue;
 }
Esempio n. 23
0
 public void InitController(ManagerBalls managerBalls, ManagerBonuses managerBonuses, IBoardData data)
 {
     _board          = data.GetBoard;
     _bonuses        = data.GetBonuses;
     _borders        = data.GetBorders;
     _managerBalls   = managerBalls;
     _managerBonuses = managerBonuses;
     _isLongBoard    = data.GetIsLongBoard;
 }
Esempio n. 24
0
 private void InitVariables()
 {
     _scoreVariable    = ScriptableObject.CreateInstance <IntVariable>();
     _currentPiece     = ScriptableObject.CreateInstance <PieceVariable>();
     _nextPiece        = ScriptableObject.CreateInstance <PieceVariable>();
     _currentMoveDelay = ScriptableObject.CreateInstance <FloatVariable>();
     _hardDrop         = ScriptableObject.CreateInstance <BoolVariable>();
     currentGiver.SetBoard(_currentBoard);
 }
Esempio n. 25
0
        /// <summary>
        /// Setup the _isClicking and _isTouching BoolVariable depending on the InteractionType and the _buttonHand variable.
        /// </summary>
        /// <returns>true if everything was setup correctly</returns>
        private bool SetupNormalButton()
        {
            // If the Interaction Type is set at NONE
            if (InteractionType == EControllerInteractionType.NONE)
            {
                Debug.LogError("Please chose a valid Interaction type in the Inspector. Disabling " + this.name + " script.");
                this.enabled = false;
                return(false);
            }

            // If the Interaction Type contains at least CLICK
            if ((InteractionType & EControllerInteractionType.CLICK) == EControllerInteractionType.CLICK)
            {
                switch (_buttonHand)
                {
                case EHand.RIGHT:
                    _geDown     = _inputContainer.RightClickEvents.Items[ControllerInputToSO.GetDownGameEventFor(ActionButton)] as GameEvent;
                    _geUp       = _inputContainer.RightClickEvents.Items[ControllerInputToSO.GetUpGameEventFor(ActionButton)] as GameEvent;
                    _isClicking = _inputContainer.RightClickBoolean.Items[ControllerInputToSO.GetClickVariableFor(ActionButton)];
                    break;

                case EHand.LEFT:
                    _geDown     = _inputContainer.LeftClickEvents.Items[ControllerInputToSO.GetDownGameEventFor(ActionButton)] as GameEvent;
                    _geUp       = _inputContainer.LeftClickEvents.Items[ControllerInputToSO.GetUpGameEventFor(ActionButton)] as GameEvent;
                    _isClicking = _inputContainer.LeftClickBoolean.Items[ControllerInputToSO.GetClickVariableFor(ActionButton)];
                    break;

                default:
                    return(false);
                }
            }

            // If the Interaction Type contains at least TOUCH
            if ((InteractionType & EControllerInteractionType.TOUCH) == EControllerInteractionType.TOUCH)
            {
                // Handle Touch events
                switch (_buttonHand)
                {
                case EHand.RIGHT:
                    _geTouched   = _inputContainer.RightTouchEvents.Items[ControllerInputToSO.GetTouchGameEventFor(ActionButton)] as GameEvent;
                    _geUntouched = _inputContainer.RightTouchEvents.Items[ControllerInputToSO.GetReleasedGameEventFor(ActionButton)] as GameEvent;
                    _isTouching  = _inputContainer.RightTouchBoolean.Items[ControllerInputToSO.GetTouchVariableFor(ActionButton)];
                    break;

                case EHand.LEFT:
                    _geTouched   = _inputContainer.LeftTouchEvents.Items[ControllerInputToSO.GetTouchGameEventFor(ActionButton)] as GameEvent;
                    _geUntouched = _inputContainer.LeftTouchEvents.Items[ControllerInputToSO.GetReleasedGameEventFor(ActionButton)] as GameEvent;
                    _isTouching  = _inputContainer.LeftTouchBoolean.Items[ControllerInputToSO.GetTouchVariableFor(ActionButton)];
                    break;

                default:
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 26
0
 // Start is called before the first frame update
 void Start()
 {
     _countingDown            = _timer.countingDown;
     _countingDown.Value      = true;
     _startTime               = _timer.startTime * 60;
     _alarmTime               = _timer.alarmTime * 60;
     _timer.currentTime.Value = _startTime;
     _currentTime             = _timer.currentTime;
 }
Esempio n. 27
0
    private void TrySaveVariable(BoolVariable var)
    {
        if (!SaveOnReset)
        {
            return;
        }

        SaveLoader.SaveBool(var);
    }
Esempio n. 28
0
        protected virtual void Init()
        {
            BoolVariable boolVar = (BoolVariable)ScriptableObject.CreateInstance("BoolVariable");

            GetComponent <TouchReceiver>().isBeingTouched = boolVar;
            GetComponent <EntityController>().touch       = boolVar;

            GetComponent <EntityController>().Init();
        }
Esempio n. 29
0
    private void Awake()
    {
        PV      = GetComponent <PhotonView>();
        buildPC = Resources.Load <BoolVariable>("BuildPC");

        if (buildPC.Value == false)
        {
            joyStick = FindObjectOfType <FloatingJoystick>();
        }
    }
Esempio n. 30
0
    public static BoolVariable New(bool p_initialValue, Action <bool> p_onSetToTrue, Action <bool> p_onSetToFalse)
    {
        BoolVariable l_boolVariable = new BoolVariable();

        l_boolVariable.m_onSetToTrue  = p_onSetToTrue;
        l_boolVariable.m_onSetToFalse = p_onSetToFalse;
        l_boolVariable.m_value        = !p_initialValue;
        l_boolVariable.Set(p_initialValue);
        return(l_boolVariable);
    }