private void Spawn(EnemyType type) { GameObject en = Random.value <= 0.5f ? Instantiate(currentEnemyType, spawnPositionLeft, this.transform.rotation, this.transform): Instantiate(currentEnemyType, spawnPositionRight, this.transform.rotation, this.transform); float movementDifficulty = baseMovementSpeed + 0.3f * currentDifficulty; if (type == EnemyType.Boss) { BossEnemy be = en.AddComponent <BossEnemy>(); be.SetValues(5, baseMovementSpeed); be.SetChargePosition(chargePositionL, chargePositionR); } else if (type == EnemyType.Smart) { SmartEnemy se = en.AddComponent <SmartEnemy>(); se.SetValues(3, GaussianRandom(movementDifficulty, 0.90f)); se.SetColor(smartEnemyColor); } else { MinionEnemy me = en.AddComponent <MinionEnemy>(); me.SetValues(1, GaussianRandom(movementDifficulty, 0.90f)); } }
private void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { GameObject e = hit.transform.gameObject; if (e.CompareTag("Location")) { if (coins >= 10) { Instantiate(defense, hit.transform.position, hit.transform.rotation); removeFromPurse(10); } else { Debug.Log("Insufficient coins."); } } else if (e.CompareTag("Enemy")) { SmartEnemy a = e.GetComponent <SmartEnemy>(); a.DamageEnemy(10); Debug.Log(a); } } } }
private void DrawEnemyShield(Graphics graphics, SmartEnemy enemy, Rectangle destRect) { if (enemy != null && enemy.IsShieldActive) { graphics.FillEllipse(ShieldBrush, destRect); } }
private void Start() { _smartEnemyParent = GetComponentInParent(typeof(SmartEnemy)) as SmartEnemy; if (!_smartEnemyParent) { Debug.LogError("Parent Smart Enemy not assigned in SmartDetection script"); } }
private void OnTriggerExit(Collider other) { if (other.tag == "Player") { playerController.speed += changeSpeed; playerController.jumpForce += changeJump; } else if (other.tag == "Enemy") { enemyController = other.gameObject.GetComponent <SmartEnemy>(); enemyController.speed += changeSpeed; //enemyController.jumpForce += changeJump; } }
public static Enemy CreateHardEnemy(Field gameField) { //var prefabName = "HardEnemyAgent"; var prefabName = "HardEnemy"; var enemy = new SmartEnemy(prefabName, 100, gameField) { MovementSpeed = 1.5f, RotationSpeed = 60, Wallpass = false }; enemy.AddScriptType(typeof(EnemyWithSmartMovement)); enemy.AddScriptType(typeof(EnemyDeath)); return(enemy); }
public override void BreakAction(SmartEnemy enemy) { enemy.AddEnergy(PickUpValue * 10); Collect(enemy); }
protected virtual void Collect(SmartEnemy enemy) { }
protected override void Collect(SmartEnemy player) { CreateAcid(); }
public virtual void BreakAction(SmartEnemy enemy) { }