/// <summary> /// 初始化使用Udp网络的游戏数据 /// </summary> public void InitUdpGame() { LoadJsonData(); m_PlayerMoveManager = new PlayerMoveManager(); m_BattleLogicManager = new BattleLogicManager(); m_BulletManager = new BulletManager(); m_SpawnManager = new SpawnManager(); m_GridManager = new GridManager(); m_GridManager.InitGrid(); }
private void setReferences() { level = FindObjectOfType <Level>(); uiManagement = FindObjectOfType <UiManagement>(); playerStatus = FindObjectOfType <PlayerStatus>(); audioManager = AudioManager.getInstance(); playerItensManager = gameObject.GetComponent <PlayerItensManager>(); playerFireManager = gameObject.GetComponent <PlayerFireManager>(); playerHealthManager = gameObject.GetComponent <PlayerHealthManager>(); playerSpritesManager = gameObject.GetComponent <PlayerSpritesManager>(); playerMoveManager = gameObject.GetComponent <PlayerMoveManager>(); //audioManager = FindObjectOfType<AudioManager>(); }
public Building destinationBuilding;//vaut null si !leadsInside void OnTriggerEnter2D(Collider2D collider) { Player player = collider.GetComponent <Player>(); PlayerMoveManager playerMoveManager = collider.GetComponent <PlayerMoveManager>(); if (playerMoveManager != null && !collider.isTrigger)//On ne téléporte donc que le joueur { Transform toWarp = collider.transform; Vector3 destinationVector = destination.position; playerMoveManager.DisableMove(); toWarp.position = new Vector3(destinationVector.x, destinationVector.y, toWarp.position.z); player.isInsideBuilding = leadsInside; player.container = destinationBuilding; playerMoveManager.EnableMove(); } }