void OnTriggerEnter2D(Collider2D other) { if (other != null && other.gameObject != null) { TriangleShip ship = other.gameObject.GetComponent <TriangleShip>(); if (ship != null) { if (ship.GetShipState() == ShipState.ShipState_Alive) { PlayerManager.getInstance().PlayerDie(); } } } }
void OnTriggerEnter2D(Collider2D other) { if (other != null && other.gameObject != null) { if (IsHurtPlayer) { TriangleShip ship = other.gameObject.GetComponent <TriangleShip>(); if (ship != null) { ship.HurtByEnemy(HurtPlayerValue); } } if (IsHurtEnemy) { Monster mon = other.gameObject.GetComponent <Monster>(); if (mon != null) { mon.Hurt(HurtEnemyValue); } } if (IsHurtPlayerBullet) { ShipMBullet bu = other.gameObject.GetComponent <ShipMBullet>(); if (bu != null) { bu.DestroySelf(); } } if (IsHurtEnemyBullet) { EnemyBullet bu = other.gameObject.GetComponent <EnemyBullet>(); if (bu != null) { bu.DestroySelf(); } } } }
void OnTriggerEnter2D(Collider2D other) { if (CanFly == false) { return; } if (other != null && other.gameObject != null) { TriangleShip pShip = other.gameObject.GetComponent <TriangleShip>(); if (pShip != null) { other.gameObject.SendMessage("HurtByEnemy", 1000.0f); Destroy(this.gameObject); } } }
void OnTriggerEnter2D(Collider2D other) { if (other != null && other.gameObject != null && ChildAnimationObject != null) { TriangleShip ship = other.gameObject.GetComponent <TriangleShip>(); Animator anima = ChildAnimationObject.GetComponent <Animator>(); if (anima != null && ship != null) { anima.enabled = true; if (AnimationTriggerName != null) { anima.SetTrigger("AnimationTriggerName"); } } } }
void OnTriggerExit2D(Collider2D other) { if (other != null && other.gameObject != null) { TriangleShip ship = other.gameObject.GetComponent <TriangleShip>(); if (ship != null) { PlayerCtrl pCtrl = PlayerManager.getInstance().GetPlayerCtrl(); if (EdgeType == SceneBoundaryType.SceneBoundary_Up) { pCtrl.UnLockUpCtrl(); } else if (EdgeType == SceneBoundaryType.SceneBoundary_Down) { pCtrl.UnLockDownCtrl(); } } } }
public void PlayerDie(bool MustDie = false) { if (m_Player != null) { TriangleShip ship = m_Player.GetComponent <TriangleShip> (); if (ship != null && ship.GetShipState() == ShipState.ShipState_Alive) { if (MustDie == true) { ship.ShipDie(); } else { if (ship.IsGod == false) { ship.ShipDie(); } } } } }
void OnTriggerStay2D(Collider2D other) { if (other != null && other.gameObject != null) { TriangleShip ship = other.gameObject.GetComponent <TriangleShip>(); if (ship != null) { PlayerManager.getInstance().PlayerDie(ForcesDeath); } // if (StopBullet) { EnemyBullet bullet = other.gameObject.GetComponent <EnemyBullet>(); if (bullet != null) { Destroy(bullet.gameObject); } } } }
public void SetMainBody(TriangleShip body) { m_MainBody = body; }
public void SetMainBody(TriangleShip ship) { m_CtrlShip = ship; }
public void SetMainBody(TriangleShip ship) { m_MainBody = ship; }
public void SetShip(TriangleShip ship) { FollowShip = ship; }
public GameObject CreatePlayer(Vector2 StartPos, int LevelNum) { GameObject SceneManager = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("Prefab/" + "SceneManager")); SceneManager.transform.position = new Vector3(StartPos.x, StartPos.y, SceneManager.transform.position.z); m_SceneMover = SceneManager.GetComponent <ScenePathMover> (); m_SceneMover.LoadMiddleScene(LevelNum); m_ShipGroup = SceneManager.transform.Find("ShipGroup").gameObject; m_PlayerCtrl = m_ShipGroup.GetComponent <PlayerCtrl>(); m_Player = SceneManager.transform.Find("ShipGroup/TriangleShipObj").gameObject; TriangleShip ship = m_Player.GetComponent <TriangleShip> (); ship.StartPosObject = SceneManager.transform.Find("ShipGroup/StartPos").gameObject; ship.StartPosObject.SetActive(false); ship.BornPosObject = SceneManager.transform.Find("ShipGroup/BornPos").gameObject; ship.BornPosObject.SetActive(false); ship.CompletePosObject = SceneManager.transform.Find("CompletePos").gameObject; ship.CompletePosObject.SetActive(false); GameCamera = SceneManager.transform.Find("MainCamera").gameObject.GetComponent <LogicCamera>(); GameCamera.SetShip(ship); GameCamera.SetSceneMgrObj(SceneManager); m_EnergyBar = SceneManager.transform.Find("Canvas/EnergyBar").gameObject.GetComponent <EnergyBar>(); m_LifeBar = SceneManager.transform.Find("Canvas/LifeBar").gameObject.GetComponent <LifeBar>(); for (int i = 0; i < ship.GetCurShipLifeTimes(); ++i) { m_LifeBar.AddLife(); } m_ThanksBoard = SceneManager.transform.Find("Canvas/ThanksPlayer").gameObject.GetComponent <ThanksBoard>(); m_ThanksBoard.gameObject.SetActive(false); m_BtnCtrl = SceneManager.transform.Find("Canvas/BtnCtrl").gameObject.GetComponent <ButtonCtrl>(); m_BtnCtrl.SetMainBody(ship); #if UNITY_STANDALONE m_BtnCtrl.gameObject.SetActive(false); #else #endif MusicManager.GetInstance().SFXCtrl = SceneManager.transform.Find("SFXCtrl").gameObject.GetComponent <SoundController>(); MusicManager.GetInstance().BGMCtrl = SceneManager.transform.Find("BGMCtrl").gameObject.GetComponent <BGMController>(); m_GameOverShow = SceneManager.transform.Find("Canvas/GameOver").gameObject; m_GameOverShow.SetActive(false); return(m_Player); }
public void SetMainBody(TriangleShip ship) { BtnLeft.SetMainBody(ship); BtnRight.SetMainBody(ship); }