private void initSystem() { players = PlayerHelper.loadPlayer <List <PlayerInfo> >(); var sceneManager = new SceneManager(); gameRoot = sceneManager; gameSystem = new GameSystem() { formMain = this, option = option, gameWording = wording, players = players, sceneManager = sceneManager, gameGraphic = gameGraphic }; gameSystem.init(); gameSystem.sceneToTitlePlayer(); }
/// <summary> /// Безопасное нанесение урона (для молотова, например) /// </summary> /// <param name="player"></param> /// <param name="typeUnit"></param> /// <param name="_dmg"></param> /// <param name="condition"></param> /// <returns></returns> public float EnemyDamageSafe(PlayerHelper player, string typeUnit, float _dmg, byte condition) { _hp -= _dmg; _healthBarUnit.CmdDecreaseHealthBar(Hp); CmdPlayAudio(condition); // Звук получения урона Timing.RunCoroutine(DamageAnimation()); if (_hp <= 0) { CmdRMandXPSafe(player.gameObject, typeUnit); CmdPlayAudio(4); // Звук смерти GetComponent <BoxCollider>().enabled = false; _isAlive = false; Decreaser(); NullAttackedObject(); RpcChangeAnimation(2, false); return(Mathf.Abs(_hp)); } else { return(0); } }
/// <summary> /// Кеширование, для безопасного нанесения урона противнику (даже если владелец умрет) /// </summary> private void SaveCaching() { playerHelperInstance = instantedPlayer.InstantedPlayerReference; typeUnit = instantedPlayer.PlayerType; }