// Use this for initialization void Start() { m_currentState = SoldierState.Idle; m_rb = gameObject.GetComponent <Rigidbody2D>(); m_bulletEmitter = gameObject.GetComponent <BulletEmitter>(); GameObject l_playerOne = Managers.GetInstance().GetPlayerManager().GetPlayerOne(); GameObject l_playerTwo = Managers.GetInstance().GetPlayerManager().GetPlayerTwo(); if (m_ignorePlayerCollision) { Physics2D.IgnoreCollision(l_playerOne.GetComponent <Collider2D>(), GetComponent <Collider2D>()); Physics2D.IgnoreCollision(l_playerTwo.GetComponent <Collider2D>(), GetComponent <Collider2D>()); } //m_animator = gameObject.GetComponent<Animator>(); if (Mathf.Abs(transform.position.x - l_playerOne.transform.position.x) < Mathf.Abs(transform.position.x - l_playerTwo.transform.position.x)) { m_target = l_playerOne; } else { m_target = l_playerTwo; } }
// Use this for initialization void Awake() { Application.targetFrameRate = 60; gameObject.AddComponent <Managers>(); DontDestroyOnLoad(this); Managers.GetInstance().Init(); }
public static AudioManager GetInstance() { if (m_instance == null) { m_instance = Managers.GetInstance().gameObject.AddComponent <AudioManager>(); } return(m_instance); }
// Use this for initialization void Start() { p1 = Managers.GetInstance().GetPlayerManager().GetPlayerOne(); p2 = Managers.GetInstance().GetPlayerManager().GetPlayerTwo(); //uis = GameObject.FindGameObjectsWithTag("UI"); DragonHPBar = GameObject.FindGameObjectWithTag("DHealthBar").GetComponent <Image>(); KnightHPBar = GameObject.FindGameObjectWithTag("KHealthBar").GetComponent <Image>(); DHealth = p1.GetComponent <Health>(); KHealth = p2.GetComponent <Health>(); }
void Start() { body = this.gameObject.GetComponent <Rigidbody2D>(); state = GriffinState.Idle; GameObject[] players = new GameObject[2]; players[0] = Managers.GetInstance().GetPlayerManager().GetPlayerOne(); players[1] = Managers.GetInstance().GetPlayerManager().GetPlayerTwo(); Physics2D.IgnoreCollision(players[0].GetComponent <Collider2D>(), GetComponent <Collider2D>()); Physics2D.IgnoreCollision(players[1].GetComponent <Collider2D>(), GetComponent <Collider2D>()); bEmitter = gameObject.GetComponent <BulletEmitter>(); if (Mathf.Abs(transform.position.x - players[0].transform.position.x) < Mathf.Abs(transform.position.x - players[1].transform.position.x)) { targetPlayer = players[0]; speed = -Math.Abs(speed); if (!m_isBomber) { bEmitter.Patterns[0] = "line:3:20"; bEmitter.Refresh(); } else { bEmitter.Patterns[0] = "line:1:-15"; bEmitter.Refresh(); } } else { targetPlayer = players[1]; speed = Math.Abs(speed); if (!m_isBomber) { bEmitter.Patterns[0] = "line:3:-20"; bEmitter.Refresh(); } else { bEmitter.Patterns[0] = "line:1:15"; bEmitter.Refresh(); } FlipSprite(); } idealHeight = transform.position.y; }
// Use this for initialization void Start() { m_currentState = KamikazeState.Idle; m_rb = gameObject.GetComponent <Rigidbody2D>(); GameObject l_playerOne = Managers.GetInstance().GetPlayerManager().GetPlayerOne(); GameObject l_playerTwo = Managers.GetInstance().GetPlayerManager().GetPlayerTwo(); m_animator = gameObject.GetComponent <Animator>(); if (Mathf.Abs(transform.position.x - l_playerOne.transform.position.x) < Mathf.Abs(transform.position.x - l_playerTwo.transform.position.x)) { m_target = l_playerOne; } else { m_target = l_playerTwo; } }
//spawn playerSprites + initialization private void SpawnPlayers() { m_playerCharacters[0] = GameObject.Instantiate(Managers.GetInstance().GetGameProperties().Player1_prefab); if (GameObject.FindGameObjectWithTag("DSpawn")) { m_playerCharacters[0].transform.position = GameObject.FindGameObjectWithTag("DSpawn").transform.position; } else { m_playerCharacters[0].transform.position = new Vector2(-10, 0); } m_playerCharacters[0].GetComponent<PlayerController>().PlayerCamera = m_playerCameras[0]; m_playerControllers[0] = m_playerCharacters[0].GetComponent<PlayerController>(); m_playerCharacters[1] = GameObject.Instantiate(Managers.GetInstance().GetGameProperties().Knight_prefab); if (GameObject.FindGameObjectWithTag("KSpawn")) { m_playerCharacters[1].transform.position = GameObject.FindGameObjectWithTag("KSpawn").transform.position; } else { m_playerCharacters[1].transform.position = new Vector2(10, 0); } m_playerCharacters[1].GetComponent<KnightController>().PlayerCamera = m_playerCameras[1]; m_playerControllers[1] = m_playerCharacters[1].GetComponent<KnightController>(); //m_playerControllers[1].PlayerCamera = m_playerCameras[1]; }
// Use this for initialization void Start() { m_player1 = Managers.GetInstance().GetPlayerManager().GetPlayerOne().GetComponent <PlayerController>(); m_player2 = Managers.GetInstance().GetPlayerManager().GetPlayerTwo().GetComponent <PlayerController>(); }
//spawn cameras + initialization private void SpawnCameras() { GameObject Cameraroot = GameObject.Instantiate(Managers.GetInstance().GetGameProperties().Cameras_prefab); m_playerCameras[0] = Cameraroot.transform.GetChild(0).gameObject; m_playerCameras[1] = Cameraroot.transform.GetChild(1).gameObject; }