void OnTriggerEnter2D(Collider2D col) { EnemyController enemy = col.GetComponent <EnemyController>(); EnemyController1 enemy1 = col.GetComponent <EnemyController1>(); EnemyController3 enemy3 = col.GetComponent <EnemyController3>(); EnemyController4 enemy4 = col.GetComponent <EnemyController4>(); EnemyController5 enemy5 = col.GetComponent <EnemyController5>(); Destructible des = col.GetComponent <Destructible>(); if (enemy != null) { enemy.TakeDamage(40); } else if (enemy1 != null) { enemy1.TakeDamage(40); } else if (enemy3 != null) { enemy3.TakeDamage(40); } else if (enemy4 != null) { enemy4.TakeDamage(40); } else if (enemy5 != null) { enemy5.TakeDamage(40); } else if (des != null) { des.TakeDamage(40); } Destroy(gameObject); }
// float playerInterval; void Start() { if (managerInstance == null) { managerInstance = this; } DontDestroyOnLoad(this); //playerScript = player.GetComponent<PlayerGunController2> (); playerGunCtrlScript = playerGun.GetComponent <PlayerGunController2>(); enemyController1Script = enemyObj.GetComponent <EnemyController1> (); cameraScript = cameraObj.GetComponent <CameraGUIcontroller> (); curPlayerLife = PlayerLife; curEnemyLife = totalEnemyNum; generateEnemyNum = 0; // cameraScript.tryText.text = ""; setNullToText(); // stageManagerScript = stageManagerObj.GetComponent<StageManager> (); enemyInterval = 0.0f; // playerInterval = 0.0f; isPlayerDead = false; SetActivePlayerGun(); enemies = enemyObj.transform.parent.gameObject; // sliderValueSet (100f); }
void OnCollisionEnter2D(Collision2D other) { EnemyController1 enemy = other.collider.GetComponent <EnemyController1>(); if (enemy != null) { enemy.Destroy(); } BossController boss = other.collider.GetComponent <BossController>(); if (boss != null) { boss.Hit(-1); } Destroy(gameObject); }
void Start() { if (instance == null) { instance = this; } DontDestroyOnLoad(this); playerGunCtrlScript = playerGun.GetComponent <PlayerGunController2>(); enemyController1Script = enemyObj.GetComponent <EnemyController1> (); curStageNo = stages[1]; stageName = ""; //Start画面作ったら、要変更 state = State.Play; }
void Start() { enemyController1Script = enemyObj.GetComponent <EnemyController1> (); }
// EnemyController2 enemyController; // EnemyController3 enemyController; void Start() { //EnemyControllerクラスの変数にenemyオブジェクトのコンポーネントを代入する enemyController = enemyObj.GetComponent <EnemyController1> (); }