using Comp; using Sound; using UnityEngine; namespace Game { public class GamePendingState : GameState { private const float CockInitialX = 2f; private const float StaticOffset = -2.534481f; private const float MastInitialX = 6f; public override void PlayBattle() { Debug.Log("play battle"); _gameCore.GetController(_gameCore.localPlayer).Run(); _gameCore.GetController(_gameCore.antiPlayer).Run(); } public override void BattleStart() { _gameCore.TransitionToState(_gameCore.battleState); _gameCore.GetCurState().BattleStart(); } public override void LiftCock() { // 啥都不做 } public override void ExitBattle() { } public override void EndBattle() { // 啥都不做 } public override void EnterState() { Debug.Log("enter pending state"); // 处理鸡模型 var localCockPrefab = CockFactory.Instance.GenerateCockPrefab(_gameCore.localPlayer.cockId); var antiCockPrefab = CockFactory.Instance.GenerateCockPrefab(_gameCore.antiPlayer.cockId); var localCock = Object.Instantiate(localCockPrefab); var antiCock = Object.Instantiate(antiCockPrefab); var localCockActionComp = localCock.GetComponent(); localCockActionComp.cockId = _gameCore.localPlayer.cockId; var antiCockActionComp = antiCock.GetComponent(); antiCockActionComp.cockId = _gameCore.antiPlayer.cockId; localCockActionComp.playerId = _gameCore.localPlayer.playerId; antiCockActionComp.playerId = _gameCore.antiPlayer.playerId; _gameCore.cockDict.Add(_gameCore.localPlayer.playerId, localCockActionComp); _gameCore.cockDict.Add(_gameCore.antiPlayer.playerId, antiCockActionComp); localCock.GetComponent().Tag = "player-" + _gameCore.localPlayer.playerId; antiCock.GetComponent().Tag = "player-" + _gameCore.antiPlayer.playerId; localCock.transform.eulerAngles = new Vector3(0, 90, 0); antiCock.transform.eulerAngles = new Vector3(0, -90, 0); localCock.transform.position = new Vector3(-CockInitialX - StaticOffset, localCock.transform.position.y, localCock.transform.position.z); antiCock.transform.position = new Vector3(CockInitialX - StaticOffset, antiCock.transform.position.y, antiCock.transform.position.z); localCock.transform.parent = _gameCore.parent.transform; antiCock.transform.parent = _gameCore.parent.transform; // 处理主人模型 var masterPrefab = Resources.Load("Human/prefab_master"); var localMaster = Object.Instantiate(masterPrefab); var antiMaster = Object.Instantiate(masterPrefab); localMaster.transform.position = new Vector3(-MastInitialX - StaticOffset, localMaster.transform.position.y, localMaster.transform.position.z); antiMaster.transform.position = new Vector3(MastInitialX - StaticOffset, antiMaster.transform.position.y, antiMaster.transform.position.z); antiMaster.transform.eulerAngles = new Vector3(0, -90f, 0); localMaster.transform.parent = _gameCore.parent.transform; antiMaster.transform.parent = _gameCore.parent.transform; var localMasterActionComp = localMaster.GetComponent(); localMasterActionComp.playerId = _gameCore.localPlayer.playerId; var antiMasterActionComp = antiMaster.GetComponent(); antiMasterActionComp.playerId = _gameCore.antiPlayer.playerId; _gameCore.masterDict.Add(_gameCore.localPlayer.playerId, localMasterActionComp); _gameCore.masterDict.Add(_gameCore.antiPlayer.playerId, antiMasterActionComp); SoundCore.Instance.PlaySound(SoundType.BattleBgmStart, SoundCtrl.BattleEnvPlayer); Debug.Log("enter pending state finish"); } public override void ExitState() { // 啥都不做 } public GamePendingState(GameCore gameCore) : base(gameCore) { } } }