コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        myRigidbody = GetComponent <Rigidbody2D>();
        animator    = GetComponentInChildren <Animator>();

        SetAnimatorDirection(direction);
        playerState.SetValue("Idle");
    }
コード例 #2
0
 public void SendSpinRequest()
 {
     if (!isWheelEnable.Value)
     {
         prizeString.SetValue("");
         SocketRequest.getInstance().SendSpinRequest();
     }
 }
コード例 #3
0
        public void Kill(HarmfulObject _obj)
        {
            Lives = 0;

            Dead.SetValue(true);
            DeathMessage.SetValue(_obj.GetMessage());
            m_Body.bodyType = RigidbodyType2D.Static;
        }
コード例 #4
0
 public void GetAgentProperties()
 {
     AgentAge.SetValue(Agent.CurrentAge);
     AgentType.SetValue(Agent.AgentType);
     StateName.SetValue(Agent.State);
     AgentHunger.SetValue(Agent.NeedsManager.NeedsValues[HUNGRY]);
     AgentHorny.SetValue(Agent.NeedsManager.NeedsValues[HORNY]);
     AgentEnergy.SetValue(Agent.Energy / 100f);
 }
コード例 #5
0
ファイル: Household.cs プロジェクト: mkpietrzyk/LD48-milk
 private void OnMouseDown()
 {
     if (String.IsNullOrEmpty(connectedTo) && !String.IsNullOrEmpty(connectedFrom))
     {
         gameObject.tag = "selected";
         selectedObjectID.SetValue(uniqueID);
         Instantiate(connectionLine, transform.position, Quaternion.identity);
     }
 }
コード例 #6
0
    public void GetBuildingProperties()
    {
        BuildingType.SetValue(Building.BuildingType.name);
        BuildingActive.SetValue(Building.UserOverrideBuildingActive);
        BuildingProduction.SetValue(1 / Time.deltaTime * Building.AddedValue);
        WorkingAgents.SetValue(Building.AgentsWorking);
        EnergyUpkeep.SetValue(Building.BuildingType.EnergyUpkeep);
        WaterUpkeep.SetValue(Building.BuildingType.WaterUpkeep);
        StoneUpkeep.SetValue(Building.BuildingType.StoneUpkeep);
        WoodUpkeep.SetValue(Building.BuildingType.WoodUpkeep);
        MineralsUpkeep.SetValue(Building.BuildingType.MineralUpkeep);

        if (Building.Resource != null)
        {
            ResourceType.SetValue(Building.Resource.typeOfResource.ToString());
            RemainingResource.SetValue(Building.ResourceAmount);
            ResourceColor.SetColor(Building.Resource.transform.GetChild(2).GetComponent <SpriteRenderer>().color);
        }
    }
コード例 #7
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        StringVariable variable = (StringVariable)target;

        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        valueToSet = GUILayout.TextField(valueToSet, 50);
        if (GUILayout.Button("Set value"))
        {
            variable.SetValue(valueToSet);
            variable.Save();
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(20);

        if (variable.isPersistent)
        {
            if (GUILayout.Button("Load pref"))
            {
                variable.Load();
            }

            if (GUILayout.Button("Reset pref"))
            {
                variable.Clear();
            }

            if (GUILayout.Button("Set default"))
            {
                variable.SetValue(variable.DefaultValue);
                variable.Save();
            }

            if (GUILayout.Button("Reset all prefs"))
            {
                PlayerPrefs.DeleteAll();
            }
        }
    }
コード例 #8
0
 // Update is called once per frame
 void Update()
 {
     if (isActive)
     {
         if (Input.GetKeyDown(KeyCode.E))
         {
             s.SetValue(signText);
             sign.SetActive(!sign.activeSelf);
         }
     }
     else
     {
         //sign.SetActive(false);
     }
 }
コード例 #9
0
 public void LoadSceneWithFadeCallback(StringVariable name)
 {
     if (name != null)
     {
         newSceneToLoad.SetValue(name);
         Scene scene = SceneManager.GetSceneByName(loadSceneEffectName);
         if (scene.name != loadSceneEffectName.value)
         {
             SceneManager.LoadScene(loadSceneEffectName, LoadSceneMode.Additive);
         }
     }
     else
     {
         Debug.LogWarning("Please set a valid name string variable");
     }
 }
コード例 #10
0
        public void BindValueFromInput(string newValue)
        {
            if (variableString != null)
            {
                variableString.SetValue(newValue);
            }

            if (variableInt != null)
            {
                if (newValue != "")
                {
                    int x = 0;
                    if (Int32.TryParse(newValue, out x))
                    {
                        variableInt.SetValue(x);
                    }
                }
                else
                {
                    variableInt.SetValue(null);
                }
            }
        }
コード例 #11
0
 public static void SetDate(DateTime date, StringVariable variable)
 {
     variable.SetValue(date.ToString());
 }
コード例 #12
0
        public override void Execute(MonoBehaviour _behaviour)
        {
            Assert.IsNotNull(String);

            String.SetValue(Value.GetValue());
        }
コード例 #13
0
ファイル: MilkFactory.cs プロジェクト: mkpietrzyk/LD48-milk
 private void OnMouseDown()
 {
     gameObject.tag = "selected";
     selectedObjectID.SetValue("factory");
     Instantiate(connectionLine, transform.position, Quaternion.identity);
 }
コード例 #14
0
ファイル: ShipManager.cs プロジェクト: thevinter/Re-Ship
    IEnumerator Tick()
    {
        if (canEvent)
        {
            GenerateEvents();
        }
        var temp = new Dictionary <ShipStat, int> {
            { ShipStat.Food, 0 },
            { ShipStat.Heat, 0 },
            { ShipStat.Energy, 0 },
            { ShipStat.Motors, 0 },
            { ShipStat.Happiness, 0 },
            { ShipStat.Buoyancy, 0 },
            { ShipStat.Antigravity, 0 },
            { ShipStat.Evilness, 0 }
        };

        if (depth > 300 && !monster1)
        {
            monster1 = true;
            MonsterEvent1();
        }

        if (depth > 600 && !monster2)
        {
            monster2 = true;
            MonsterEvent2();
        }

        if (depth > 900 && !monster3)
        {
            monster3 = true;
            MonsterEvent3();
        }
        controlUnit = controlRoom.hasUnit ? 1 : 0;
        var shitty_vars = new Dictionary <ShipStat, int> {
            { ShipStat.Buoyancy, Random.Range(-1, 2) },
            { ShipStat.Antigravity, Random.Range(-1, 2) },
            { ShipStat.Evilness, Random.Range(-1, 2) }
        };

        SetStats(shitty_vars, temp);



        if (controlRoom.hasUnit && !controlRoom.isBroken)
        {
            depth += 4 * shipStats[ShipStat.Motors] - (int)(shipStats[ShipStat.Buoyancy] * 0.1f);
        }

        depth_var.SetValue(depth.ToString());
        foreach (IShip s in shipRooms)
        {
            SetStats(s.Tick(), temp);
            s.ResetStats();
        }

        if (events != null)
        {
            foreach (IEvent e in events)
            {
                SetStats(e.Tick(), temp);
            }
        }
        events = new List <IEvent>(GetComponentsInChildren <IEvent>());
        Dictionary <ShipStat, int> tickStats = new Dictionary <ShipStat, int> {
            { ShipStat.Food, -active_units.Count },
            { ShipStat.Heat, -3 },
            { ShipStat.Energy, -Random.Range(1, 5) },
            { ShipStat.Happiness, -Random.Range(1, 4) },
        };

        SetStats(tickStats, temp);
        delta = temp;
        yield return(new WaitForSeconds(5f));

        canCall = true;
        yield return(null);
    }
コード例 #15
0
ファイル: ShipManager.cs プロジェクト: thevinter/Re-Ship
    void DuelEvent()
    {
        var i      = Random.Range(0, 3);
        var unit_1 = active_units[i];
        var unit_2 = active_units[(i + 1) % 3];
        var str1   = Random.Range(1, 21) + unit_1.GetStats()[UnitStat.combat];
        var str2   = Random.Range(1, 21) + unit_2.GetStats()[UnitStat.combat];

        string[] body        = { "abdomen", "right leg", "neck", "front", "back", "left leg", "torso", "right arm", "left arm" };
        var      random_body = body[Random.Range(0, body.Length)];

        if (str1 > str2)
        {
            infoText.SetValue(System.String.Format("Due to deteriorating psychological conditions {0} challenged {1} to a duel and won. {1} has been left with a scar on {2} {3}.\n[{2} stats are halved]",
                                                   unit_1.unit_name, unit_2.unit_name, unit_2.possessive_selection, random_body));
            unit_2.addToBio(System.String.Format("{0} got a scar while fighting {1}. ", unit_2.pronoun, unit_1.name));
            unit_1.addToBio(System.String.Format("{0} challenged {1} to a duel and won. ", unit_1.pronoun, unit_2.name));
            unit_2.HalfStats();
        }
        else
        {
            infoText.SetValue(System.String.Format("Due to deteriorating psychological conditions {0} challenged {1} to a duel and lost. {0} has been left with a scar on {2} {3}.\n[{2} stats are halved]",
                                                   unit_1.unit_name, unit_2.unit_name, unit_1.possessive_selection, random_body));
            unit_1.addToBio(System.String.Format("{0} got a scar while fighting {1}. ", unit_1.pronoun, unit_2.name));
            unit_1.addToBio(System.String.Format("{0} challenged {1} to a duel and lost. ", unit_1.pronoun, unit_2.name));
            unit_2.addToBio(System.String.Format("{0} won a duel against {1}. ", unit_2.pronoun, unit_1.name));
            unit_1.HalfStats();
        }
        infoEvent.Raise();
    }
コード例 #16
0
ファイル: Launcher.cs プロジェクト: martinnnnnn/arashmup
 public void ChangePlayerCharacter(RuntimeAnimatorController animController)
 {
     AnimatorControllerName.SetValue(animController.name);
 }