public Stat(e_stats _key, int _value) { key = _key; baseValue = _value; currentValue = _value; buffDuration = 0; }
public void ModifyStatHeroPiece(int _index, e_stats _key, int _value, int _duration, int _tick) { object[] toSend = new object[] { _index, (int)_key, _value, _duration, _tick }; if (connection != null) { connection.Send("ModifyStatHeroPiece", toSend); } }
public Color GetColor(e_stats _key) { foreach (StatColor c in StatColors) { if (c.Stat == _key) { return(c.Color); } } return(Color.magenta); }
public void ModifyStat(e_stats _key, int _value, int _duration, int _tick) { if (stats.ContainsKey(_key)) { stats[_key].UpdateValue(_value, _duration, _tick); } if (_key == e_stats.Health && _value < 0) { GameplayManager.Instance.PoolManager.Instantiate("BaseSlash", transform.position, Vector3.zero, null); } else { GameObject fx = GameplayManager.Instance.PoolManager.Instantiate("BaseBuff", transform.position, Vector3.zero, null); fx.GetComponent <BuffFX>()?.ChangeColor(_key); } UpdateUI(); if (stats[e_stats.Health].CurrentValue <= 0) { Death(); } }
public void ModifyStatHeroPiece(int _index, e_stats _key, int _value, int _duration, int _tick) { pieces[_index].ModifyStat(_key, _value, _duration, _tick); }
//Loop void FixedUpdate() { foreach (Message m in messages) { #region Join/Left Room if (m.Type == "PlayerJoined") { if (!teamAttributed) { team = (e_teams)m.GetInt(0); teamAttributed = true; } if (m.GetInt(0) == 2) { if (currentStatus == e_status.Default) { GetComponent <SelectionInputs>().StartSelection(team); currentStatus = e_status.InSelection; } } } else if (m.Type == "PlayerLeft") { if (currentStatus == e_status.InSelection) { DisconnectMe(); } else if (currentStatus == e_status.InGame) { gameplayManager.GameEnd(); currentStatus = e_status.GameEnded; } } else if (m.Type == "FullRoom") { ListRoomsJoin(roomInfos.ToArray()); } #endregion #region Initialization Checks else if (m.Type == "TeamValidated") { for (int i = 0; i < 6; i++) { heroes[i] = m.GetInt((uint)i); } SceneTransi.ToExecute exe = LoadGameplay; SceneTransi.Instance.Transi(true, exe); } else if (m.Type == "SceneLoaded") { gameplayManager = FindObjectOfType <GameplayManager>(); gameplayManager.Init(this, team, heroes); gameplayManager.OnEnnemyTurn += EnnemyTurn; SceneTransi.Instance.Transi(false, null); Destroy(GetComponent <SelectionInputs>()); currentStatus = e_status.InGame; } else if (m.Type == "PlacementValidated") { gameplayManager.BoardManager.PlacementValidated(); } else if (m.Type == "GameStart") { gameplayManager.GameStart(); } #endregion #region In Game else if (m.Type == "MoveHeroPiece") { int index = -1; index = m.GetInt(0); Vector2Int desti = new Vector2Int(m.GetInt(1), m.GetInt(2)); bool useMove = m.GetBoolean(3); gameplayManager.BoardManager.MoveHeroPiece(index, desti, useMove); } else if (m.Type == "ModifyStatHeroPiece") { int index = -1; index = m.GetInt(0); e_stats key = (e_stats)m.GetInt(1); int value = m.GetInt(2); int duration = m.GetInt(3); int tick = m.GetInt(4); gameplayManager.BoardManager.ModifyStatHeroPiece(index, key, value, duration, tick); } else if (m.Type == "YourTurn") { gameplayManager.YourTurn(); } else if (m.Type == "Eliminated") { gameplayManager.Eliminated((e_teams)m.GetInt(0)); if (m.GetInt(1) <= 1) { gameplayManager.GameEnd(); currentStatus = e_status.GameEnded; } } #endregion } messages.Clear(); }
public void NotifyStat(e_stats _key, int _value, int _duration, int _tick) { GameplayManager.Instance.OnlineManager.ModifyStatHeroPiece(index, _key, _value, _duration, _tick); //ModifyStat(_key, _value, _duration); }
public void ChangeColor(e_stats _key) { ParticleSystem.MainModule main = explosion.main; main.startColor = GameplayManager.Instance.Data.GetColor(_key); }