public override bool runAction(BossGOAP boss) { LevelManager.Instance.bossWave = true; boss.anim.SetTrigger("CallBackup"); boss.StartCoroutine("CallBackUpAction"); return(true); }
// Start is called before the first frame update void Start() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } source = GetComponent <AudioSource>(); if (isThereBegVoiceAct) //if level does not have beginning voicing { StartCoroutine("BeginningVoiceActing"); } currentWave = waves[wavePoint]; bossWave = false; if (boss != null) { bossCode = boss.GetComponent <BossGOAP>(); } currentVoice = null; grid = new AGrid(this.transform, gridSizeX, gridSizeY, nodeRadius, unwalkable);// set up astar dll grid.CreateNodes(); pathfinding = new APathFinding(); }
public override bool runAction(BossGOAP boss) { boss.anim.SetFloat("speed", 0); boss.anim.SetTrigger("Shoot"); boss.gun.SetActive(true); boss.StartCoroutine("ShootPlayer"); return(true); }
public override bool runAction(BossGOAP boss) { boss.anim.SetFloat("speed", 0); boss.anim.SetTrigger("Teleport"); boss.StartCoroutine(boss.Teleport(boss.healPosition.position, 1f)); return(true); }
public override void Fire() { if (Input.GetMouseButton(0) && Time.time >= lastShot && ammo > 0 && !isReloading && !isHolster & !isDraw && !move.sprint) { audioo.Play(); rec.AddRecoil(Random.Range(-1, 2) / 2f, Random.Range(0, 3) / 2f); startPoint = cam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0)); ammo--; muzzleParticles.Emit(Random.Range(2, 4)); anim.SetTrigger("fire"); GameObject bullet1 = Instantiate(bullet, bulletLocation.transform.position, bulletLocation.transform.rotation); bullet1.GetComponent <Rigidbody>().velocity = bullet1.transform.forward * 500; lastShot = Time.time + fireRate; RaycastHit hit; if (Physics.Raycast(startPoint, cam.transform.forward, out hit, range)) { Debug.Log("haha"); if (hit.collider.gameObject.layer == enemyLayer) { if (hit.collider.gameObject.GetComponentInParent <EnemyAbstract>() != null) { EnemyAbstract basic = hit.collider.gameObject.GetComponentInParent <EnemyAbstract>(); basic.hit = hit; basic.Damage(damage); } else { BossGOAP basic = hit.collider.gameObject.GetComponentInParent <BossGOAP>(); basic.Damage(damage); } } else if (hit.collider.gameObject.layer == barrelLayer) { hit.collider.gameObject.GetComponent <Barrel>().StartCoroutine("Explodo"); } else { if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * 5); } } } } }
public override bool runAction(BossGOAP boss) { if (Time.time - boss.lastTimeFired <= 0) { if (boss.check == false) { if (boss.useAStar) { boss.StartCoroutine("GetPlayerDirection"); } } boss.anim.SetFloat("speed", 1); if (Vector3.Distance(boss.transform.position, boss.allWalkLocations[boss.selectedPath][boss.selectedLocation].position) <= 2) { if (boss.selectedLocation == boss.allWalkLocations[boss.selectedPath].Count - 1) { boss.selectedLocation = 0; } else { boss.selectedLocation++; } } if (boss.useAStar) { if (boss.waypoints != null && boss.waypoints.Count != 0) { transform.position = Vector3.MoveTowards(boss.transform.position, boss.waypoints[0], boss.speed * Time.deltaTime); transform.LookAt(new Vector3(boss.waypoints[0].x, transform.position.y, boss.waypoints[0].z)); if (this.transform.position == boss.waypoints[0]) { boss.waypoints.RemoveAt(0); } } } else { boss.agent.destination = boss.allWalkLocations[boss.selectedPath][boss.selectedLocation].position; } return(false); } else { return(true); } }
public override bool runAction(BossGOAP boss) { boss.anim.SetFloat("speed", 0); boss.anim.SetTrigger("Teleport"); if (boss.selectedPath == boss.allWalkLocations.Count - 1) { boss.selectedPath = 0; } else { boss.selectedPath++; } boss.StartCoroutine(boss.Teleport(boss.allWalkLocations[boss.selectedPath][boss.selectedPath].position, 1f)); boss.worldState.states.Clear(); boss.worldState.states.Add("canMove"); return(true); }
public override bool runAction(BossGOAP boss) { if (boss.currentHealth >= boss.maxHealth || boss.damageTaken >= 100) { Debug.Log("damaged"); if (boss.currentHealth >= boss.maxHealth) { boss.currentHealth = boss.maxHealth; } boss.StartCoroutine(boss.Teleport(boss.allWalkLocations[boss.selectedPath][boss.selectedPath].position, 1f)); boss.worldState.states.Clear(); boss.worldState.states.Add("canMove"); return(true); } else { Debug.Log(boss.damageTaken); Debug.Log("Healing"); boss.Damage(-50f * Time.deltaTime); return(false); } }
// Start is called before the first frame update public virtual bool runAction(BossGOAP boss) { return(false); }