private void OnTriggerEnter(Collider collision) { Debug.Log("Hitting something"); if (collision.CompareTag("Player") && triggerEnabled) { SceneSwitchController ssc = GameObject.Find("Scene Switcher").GetComponent <SceneSwitchController>(); ssc.passingGameObject = this.gameObject; ssc.passingObject = this.gameObject.GetComponent <Enemy>(); ssc.save = true; } }
// Use this for initialization void Start() { //Set the "state" string to "player" if the player should go first, "enemy" if not. state = "player"; defenseEffect = 0; baseDefense = GameController.player.defense; //Link this controller to both fighters. enemy.fightController = this; GameController.player.fightController = this; //Get all moves initialized. MoveUtils.InitMoves(); hasFallen = true; isRising = false; //Get the scene active scene switcher and get the enemy from that. //First, get the game object then get it's controller. GameObject sc = GameObject.Find("Scene Switcher"); SceneSwitchController ssc = null; animationNeeded = false; if (sc != null) { ssc = sc.GetComponent <SceneSwitchController>(); } if (ssc != null) { Debug.Log("TEST"); ssc.fc = this; ssc.fc_go = this.gameObject; passedEnemy = (Enemy)ssc.passingObject; Debug.Log(passedEnemy.name); } InitializeFighters(); }