IEnumerator StageThreeRoutine() { float initialWaitDuration = 2.0f; yield return(new WaitForSeconds(initialWaitDuration)); //Spawn Second character float durationToWaitNearEnemy = 1.0f; Character c = charactersToSpawn[0]; c.gameObject.SetActive(true); c.gameObject.transform.position = enemyEntrancePoint.transform.position; //Resume the movement just in case if it's paused if (c.GetComponent <Enemy>()) { c.GetComponent <Enemy>().ResumeMovement(); } EnemyBehaviorAI.ForceChaseBehavior(c.GetComponent <Enemy>(), player); charactersToSpawn.Remove(c); cameraScript.FocusCameraAt(enemyEntrancePoint.transform.position, 3, durationToWaitNearEnemy); CageTrap.CharacterCaughtEvent += StageFour; }
IEnumerator StageTwo(float durationOfwaitAtCages) { float extraBufferPeriod = 3.0f; yield return(new WaitForSeconds(durationOfwaitAtCages + extraBufferPeriod)); //Spawn first character float durationToWaitNearEnemy = 1.0f; Character c = charactersToSpawn[0]; c.gameObject.SetActive(true); c.gameObject.transform.position = enemyEntrancePoint.transform.position; //Resume the movement just in case if it's paused if (c.GetComponent <Enemy>()) { c.GetComponent <Enemy>().ResumeMovement(); } EnemyBehaviorAI.ForceChaseBehavior(c.GetComponent <Enemy>(), player); charactersToSpawn.Remove(c); cameraScript.ChangeCameraProjectionSize(15, 3); cameraScript.FocusCameraAt(enemyEntrancePoint.transform.position, 3, durationToWaitNearEnemy); CageTrap.CharacterCaughtEvent += StageThree; }
void StartChase() { for (int i = 0; i < objectsToSpawn.Count; i++) { EnemyBehaviorAI.ForceChaseBehavior(objectsToSpawn[i].GetComponent <Enemy>(), player); } }
public void GettingAbsorbed(Character c, float duration) { //Change the behavior to getting absorbed behaviorAI = null; c.BlockInputs(duration, true, true); //Blocking player's inputs BlockInputs(duration, true, true); //Blocking character's inputs also behaviorAI = new GettingAbsorbedBehavior(enemy, aiComponent, c, duration); }
public override void Stun(float duration) // public void Stun(float duration) { //Revert the enemy behavior to roaming for now. Later there might be a separate stun behavior if (behaviorAI.GetType() != typeof(StunnedBehavior)) { //StartCoroutine(StunResetCoroutine(duration)); BlockInputs(duration, true, false); behaviorAI = new StunnedBehavior(enemy, aiComponent, duration); } }
private void Start() { inventory = GetComponentInChildren <EnemyInventory>(); //if (inventory != null) //{ // enemyItem.itemProperties.maxHoldingCapacity = 10000; // inventory.AddItem(enemyItem); // Debug.Log("Inventory is not null and item added"); //} enemy = this; aiComponent = GetComponent <AI>(); //if(!aiComponent.persistentChase) behaviorAI = new RoamingBehavoir(enemy, aiComponent); Debug.Log("script is working"); State = new IdleState(); ceilingCheck = gameObject.transform.Find("CeilingCheck").gameObject; groundCheck = gameObject.transform.Find("GroundCheck").gameObject; playerSprite = transform.Find("Sprite").gameObject; Hand = playerSprite.transform.Find("Hand").gameObject; playerAudio = GetComponent <PlayerAudio>(); audioSource = GetComponent <AudioSource>(); info = CastGroundOverlapCircle(); StateList = new List <States>(); StateList.Add(new IdleState()); StateList[0].UpdateState(this, userInputs, info); //inventory.Initialize(); inventory.GetComponent <EnemyInventory>().Initialize(); }