Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Soldier : EnemyBase
- {
- public bool soldier_InCombat;
- public GameObject soldier_proj;
- protected GameObject projectile;
- public Transform muzzle;
- public float delayBetweenShots;
- public float reloadDur;
- public float proj_force;
- public int max_bcount;
- protected int b_count;
- protected bool isPatrolling;
- protected bool is_Shooting;
- protected Transform soldier_Target;
- protected Rigidbody2D proj_RB;
- protected SoldierRifle s_Rifle;
- public override void Init()
- {
- base.Init();
- Health = base.health;
- s_Rifle = GetComponentInChildren<SoldierRifle>();
- soldier_Target = base.player_script.transform;
- if(base.waypoints.Length < 2)
- {
- base.anim.SetTrigger("Idle");
- isPatrolling = false;
- soldier_Target = base.player_script.transform;
- }
- else if(base.waypoints.Length >= 2)
- {
- //Debug.Log("Following waypoint paths");
- isPatrolling = true;
- }
- }
- public override void Update()
- {
- SoldierAI_Update();
- }
- void SoldierAI_Update()
- {
- if(isPatrolling == true)
- {
- base.Update();
- }
- if(isPatrolling == false)
- {
- if(base.isDead == false)
- {
- base.DeathCheck();
- base.FaceTarget();
- base.TargetDistanceCheck();
- }
- }
- if(base.inCombat == true)
- {
- //acess and run GunScript//
- //Debug.Log("Acessing Rifle Script....");
- //s_Rifle.inCombat = true;
- //Debug.Log("In combat:" + s_Rifle.inCombat);
- }
- else if(base.inCombat == false)
- {
- //Debug.Log("In combat:" + s_Rifle.inCombat);
- //s_Rifle.inCombat = false;
- }
- }
- }
Add Comment
Please, Sign In to add comment