public void ReplaceAttackSpawner(GameObject target, AttackSpawner attackSpawner) { AttackSpawner existingAttackSpawner = target.GetComponent <AttackSpawner>(); bool shouldEnable = true; if (existingAttackSpawner != null) { shouldEnable = existingAttackSpawner.enabled; //Destroy(existingAttackSpawner); } AttackSpawner createdAttackSpawner = attackSpawner.CopyComponentTo(target); createdAttackSpawner.enabled = shouldEnable; }
public void MimicPlayer() { AttackSpawner existingAttackSpawner = this.AttackSpawner; AttackSpawner playerAttackSpawner = GameManager.Player.GetComponent <AttackSpawner>(); if (existingAttackSpawner.AttackToSpawn.name == playerAttackSpawner.AttackToSpawn.name) { return; } //string playerVariableValue = this.PsiEvent.GameLevel.GetVariable("player").DataValue; //this.PsiEvent.GameLevel.SetVariable("response", playerVariableValue); bool shouldEnable = true; if (existingAttackSpawner != null) { shouldEnable = existingAttackSpawner.enabled; } AttackSpawner createdAttackSpawner = playerAttackSpawner.CopyComponentTo(this.Psi); createdAttackSpawner.enabled = shouldEnable; }