private void Start() { alertBar = GetComponentInChildren <EnemyAlertBar>(); alertBar.DisableAlertBar(); pathing = GetComponent <EnemyPathing>(); vision = GetComponentInChildren <EnemyVision>(); }
void Awake() { vision = GetComponent <EnemyVision>(); attack = GetComponent <TurretAttack>(); death = GetComponent <Enemy_Death>(); childcount = transform.childCount; }
protected virtual void ComponentSetup() { moveScript = GetComponent <MovementInterface> (); hpScript = GetComponent <HPScript> (); if (hpScript == null) { hpScript = gameObject.AddComponent <HPScript> (); } hpScript.MaxHP = maxHP; hpScript.Death += OnDeath; onCollisionDamageScript = gameObject.GetComponent <DamageOnCollision> (); if (onCollisionDamageScript == null) { onCollisionDamageScript = gameObject.AddComponent <DamageOnCollision> (); } onCollisionDamageScript.Damage = onCollisionDamage; onCollisionDamageScript.TagList = onCollisionDamageTags; visionScript = GetComponent <EnemyVision> (); if (visionScript == null) { visionScript = gameObject.AddComponent <EnemyVision> (); } visionScript.AggroDistance = aggroDistance; visionScript.AvatarDetected += OnAvatarDetected; visionScript.LostVision += OnLostVision; visionScript.SeeingAvatar += OnSeeingAvatar; }
private void Start() { // Si se reanuda desde un checkpoint posicionado después del enemigo, // éste es destruido if (GameManager.instance.deadVal >= deadVal) { Destroy(this.gameObject); } prest = GetComponent <PrestEnemyAttack>(); enemy = GetComponent <EnemyVision>(); drone = GetComponent <Drone>(); turret = GetComponent <Turret>(); ralen = GetComponent <Ralentizador>(); // Si no es el ralentizador, drone o torreta, cogemos al hijo if ((enemy != null || ralen != null) && drone == null && turret == null) { child = transform.GetChild(0); } else if (turret != null && ralen == null && drone == null) { int i = 0; bool sprite = false; while (!sprite && transform.GetChild(i) != null) { if (transform.GetChild(i).GetComponent <Animator>() != null) { child = transform.GetChild(i); sprite = true; } i++; } } }
// Use this for initialization void Start() { enemyAnim = GetComponent <Animator>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>(); rb = GetComponent <Rigidbody2D>(); vision = GameObject.FindGameObjectWithTag("GameController").GetComponent <EnemyVision>(); speed = 2; }
public static CoreSyncData ReadData(NetIncomingMessage message) { return(new CoreSyncData( message.ReadUInt16(), message.ReadUInt16(), BuffDebuff.ReadData(message), EnemyVision.ReadData(message) )); }
void Awake() { _agent = GetComponent <NavMeshAgent>(); _vision = GetComponent <EnemyVision>(); _health = GetComponent <EnemyHealth>(); _player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); _chadistAI = GameObject.FindGameObjectWithTag("Chadist AI").GetComponent <ChadistAI>(); }
public Enemy(Vector2 position) : base(position) { body = AddComponent <PawnBody>(new PawnBody()); input = AddComponent <EnemyInput>(new EnemyInput()); AddComponent(new PawnGraphics()); Health = AddComponent <Health>(new Health(100)); Vision = AddComponent <EnemyVision>(new EnemyVision()); //AddComponent(new EnemyAI()); ChangeMotionState(new MotionIdleState(this)); }
private void Start() { enemy = GetComponent <EnemyVision>(); if (enemy != null) { child = transform.GetChild(0); renderer = GetComponentInChildren <Renderer>(); animator = child.GetComponent <Animator>(); } }
// Use this for initialization void Awake() { movement = (CharacterMovement)gameObject.GetComponent(typeof(CharacterMovement)); walkingRight = false; rigplayer = (Rigidbody2D)GameObject.FindWithTag("Player").GetComponent(typeof(Rigidbody2D)); rigenemy = (Rigidbody2D)GetComponent(typeof(Rigidbody2D)); vision = (EnemyVision)GetComponent(typeof(EnemyVision)); rangeSys = (RangedSystem)GetComponent(typeof(RangedSystem)); anim = (Animator)GetComponent(typeof(Animator)); }
void Awake() { _behaviour = GetComponent <EnemyBehaviour>(); _vision = GetComponent <EnemyVision>(); _rb = GetComponent <Rigidbody>(); _health = GetComponent <EnemyHealth>(); _player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); _chadistAI = GameObject.FindGameObjectWithTag("Chadist AI").GetComponent <ChadistAI>(); }
public MinionSyncData(ushort objID, ushort hp, byte faction, float xPos, float zPos, float yRot, float wRot, byte anime, BuffDebuff buff, EnemyVision vision) : base(objID, hp) { this.faction = faction; this.xPos = xPos; this.zPos = zPos; this.yRot = yRot; this.wRot = wRot; this.anime = anime; this.buff = buff; this.vision = vision; }
public AbilitySyncData(ushort objID, byte abilityID, ushort casterObjID, byte faction, float xPos, float zPos, float yRot, float wRot, byte anime, EnemyVision vision) : base(objID) { this.abilityID = abilityID; this.casterObjID = casterObjID; this.faction = faction; this.xPos = xPos; this.zPos = zPos; this.yRot = yRot; this.wRot = wRot; this.anime = anime; this.vision = vision; }
void Start() { enemy = GetComponent <EnemyVision>(); drone = GetComponent <Drone>(); if (enemy != null && drone == null) { child = transform.GetChild(0); } anim = child.GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); vision = GetComponent <EnemyVision>(); clockwise = false; }
public HeroSyncData(ushort objID, ushort hp, ushort mp, float xPos, float zPos, float yRot, float wRot, byte anime, byte level, ushort gold, Items items, BuffDebuff buff, EnemyVision vision) : base(objID, hp) { this.mp = mp; this.xPos = xPos; this.zPos = zPos; this.yRot = yRot; this.wRot = wRot; this.anime = anime; this.level = level; this.gold = gold; this.items = items; this.buff = buff; this.vision = vision; }
private void Awake() { vision = GetComponentInChildren <EnemyVision>(); uiOffset = new Vector2((float)canvas.sizeDelta.x / 2f, (float)canvas.sizeDelta.y / 2f); snackbar = Instantiate(snackbarPrefab, canvas); CalculateSnackbarPosition(); TryGetComponent(out impulseSource); TryGetComponent(out health); health.Die += () => Destroy(snackbar.gameObject); health.HealthBar = snackbar.GetComponent <Slider>(); vision.TargetFound += OnTargetFound; vision.TargetLost += OnTargetLost; transform.position = track.position; }
private void Start() { flasher = GetComponent <FlasherMovement>(); movement = GetComponent <EnemyMovement>(); drone = GetComponent <Drone>(); vision = GetComponent <EnemyVision>(); if (drone == null) { child = transform.GetChild(0); animator = child.GetComponent <Animator>(); animatorArm = child.GetChild(0).GetComponentInChildren <Animator>(); rotator = child.GetChild(0); } }
public static MinionSyncData ReadData(NetIncomingMessage message) { return(new MinionSyncData( message.ReadUInt16(), message.ReadUInt16(), message.ReadByte(), message.ReadFloat(), message.ReadFloat(), message.ReadFloat(), message.ReadFloat(), message.ReadByte(), BuffDebuff.ReadData(message), EnemyVision.ReadData(message) )); }
public static AbilitySyncData ReadData(NetIncomingMessage message) { return(new AbilitySyncData( message.ReadUInt16(), message.ReadByte(), message.ReadUInt16(), message.ReadByte(), message.ReadFloat(), message.ReadFloat(), message.ReadFloat(), message.ReadFloat(), message.ReadByte(), EnemyVision.ReadData(message) )); }
// Update is called once per frame void Update() { scriptVision = GetComponent <EnemyVision>(); List <Transform> visible = scriptVision.visibleTargets; if (visible.Count == 0) { isVisible = false; } else { isVisible = true; } //Quaternion newRotation = Quaternion.AngleAxis(90, Vector3.up); //transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, .05f); if (isVisible) { Attack(); playerEscaped = true; turning = false; turnCount = 0; } else if (playerEscaped) { if (turnCount < 210) { Rotate(); turnCount++; } else { ContinuePatroling(typeOfPath); playerEscaped = false; } //ReturnToPath(typeOfPath); } else { ContinuePatroling(typeOfPath); } }
//private stuff public void Awake() { taskList = new TaskList(); player = GameObject.Find("Player").GetComponent <PlayerControl>(); enemyVision = GetComponent <EnemyVision>(); pathFinder = GetComponent <Pathfinding.AIPath>(); //initialize state machines mainFSM = new StateMachine(this); soundManager = GameObject.Find("Sound Manager").GetComponent <SoundManager>(); soundFSM = new StateMachine(this); myAwake(); //called from derived class }
void Start() { rb = GetComponent <Rigidbody>(); attackState = AttackState.NOT_ATTACKING; state = EnemyState.PATROL; nav = GetComponent <NavMeshAgent>(); nav.destination = positions[0]; vision = GetComponent <EnemyVision>(); player_tr = player.transform; player_ctr = player.GetComponent <PlayerController>(); targetPosIndex = 0; checkedRight = false; checkedLeft = false; checking = false; turning = true; anim = GetComponentInChildren <NPCAnimationController>(); }
void OnSceneGUI() { EnemyVision FOV = (EnemyVision)target; Handles.color = Color.white; Handles.DrawWireArc(FOV.transform.position, Vector3.up, Vector3.forward, 360, FOV.view_Radius); Vector3 viewAngleA = FOV.DirFromAngle(-FOV.view_Angle / 2, false); Vector3 viewAngleB = FOV.DirFromAngle(FOV.view_Angle / 2, false); Handles.DrawLine(FOV.transform.position, FOV.transform.position + viewAngleA * FOV.view_Radius); Handles.DrawLine(FOV.transform.position, FOV.transform.position + viewAngleB * FOV.view_Radius); Handles.color = Color.red; foreach (Transform visibleTarget in FOV.visibleTargets) { Handles.DrawLine(FOV.transform.position, visibleTarget.position); } }
void InitPathing() { pathing = FindObjectOfType <Pathing>(); visionObject.transform.localScale *= visionDistance; vision = visionObject.GetComponent <EnemyVision>(); vision.watchForPlayer(playerSighted); switch (movementType) { case MovementType.LookAroundPath: movementLogic = new LookAroundMovement(gameObject, speed, pathing.GetPathPositions()); break; case MovementType.SimplePath: movementLogic = new FollowPathMovement(gameObject, speed, pathing.GetPathPositions()); break; } }
void Awake() { // Setting up the references. // ren = transform.Find("body").GetComponent<SpriteRenderer>(); frontCheck = transform.Find("frontCheck").transform; sight = transform.Find("Sight").GetComponent<EnemyVision>(); anim = GetComponent<Animator>(); GetComponent<enemyGUI> ().DamageCallback += TakeDamage; //for(int= // healthBar = this.transform.GetChild(5).GetChild(0).GetComponent<SpriteRenderer>(); //Debug.Log (this.transform.chil); // Getting the intial scale of the healthbar (whilst the player has full health). // healthScale = healthBar.transform.localScale; }
private void OnSceneGUI() { EnemyVision ev = (EnemyVision)target; Handles.color = Color.blue; Handles.DrawWireArc(ev.transform.position, Vector3.up, Vector3.forward, 360, ev.viewRadius); Vector3 viewAngleA = ev.DirFromAngle(-ev.viewAngle / 2, false); Vector3 viewAngleB = ev.DirFromAngle(ev.viewAngle / 2, false); Handles.DrawLine(ev.transform.position, ev.transform.position + viewAngleA * ev.viewRadius); Handles.DrawLine(ev.transform.position, ev.transform.position + viewAngleB * ev.viewRadius); Handles.color = Color.red; foreach (Transform visibleTarget in ev.visibleTargets) { Handles.DrawLine(ev.transform.position, visibleTarget.position); } }
void Start() { curState = EnemyState.Patrol; prevState = EnemyState.None; elapsedTime = 0.0f; health = 100; isDead = false; vision = gameObject.GetComponent <EnemyVision> (); pathfinder = gameObject.GetComponent <NavMeshAgent> (); waypoints = new Vector3[pathHolder.childCount]; for (int i = 0; i < waypoints.Length; i++) { waypoints [i] = pathHolder.GetChild(i).position; waypoints [i] = new Vector3(waypoints [i].x, transform.position.y, waypoints [i].z); } player = GameObject.FindGameObjectWithTag("Player").transform; }
//private stuff private void Awake() { //variable initalization patrolDirection = true; playerSpotted = false; isDead = false; health = 1; player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>(); //taskManager = new TaskManager.TaskState(); //class and component initialization attackPatterns = new AttackPatterns(); taskList = new TaskList(); enemyVision = new EnemyVision(this); pathFinder = GetComponent <AIPath>(); //initialize state machines mainFSM = new StateMachine(this); attackFSM = new StateMachine(this); myAwake(); //called from derived class }
void OnEnable() { // Setting up the references. // ren = transform.Find ("body").GetComponent<SpriteRenderer> (); frontCheck = transform.Find ("frontCheck").transform; frontGroundCheck = transform.Find ("frontGroundCheck").transform; groundCheck = transform.Find ("groundCheck").transform; // score = GameObject.Find("Score").GetComponent<Score>(); sight = transform.Find ("Sight").GetComponent<EnemyVision> (); anim = GetComponent<Animator> (); // GetComponent<Rigidbody2D> ().velocity = new Vector2 (Mathf.Sign ((GameObject.FindGameObjectWithTag ("Player").transform.position.x) - transform.position.x) * moveSpeed, GetComponent<Rigidbody2D> ().velocity.y); GetComponent<enemyGUI>().DamageCallback += TakeDamage; GameEventManager.GameStart += GameStart; //for(int= // healthBar = this.transform.GetChild (5).GetChild (0).GetComponent<SpriteRenderer> (); //Debug.Log (this.transform.chil); // Getting the intial scale of the healthbar (whilst the player has full health). // healthScale = healthBar.transform.localScale; }
void Start() { RB = GetComponent <Rigidbody2D>(); levelManager = FindObjectOfType <LevelManager>(); enemyVision = FindObjectOfType <EnemyVision>(); }
void Awake() { enemyVision = GetComponent<EnemyVision> (); nav = GetComponent<NavMeshAgent> (); player = GameObject.FindGameObjectWithTag ("Player"); }
public CoreSyncData(ushort objID, ushort hp, BuffDebuff buff, EnemyVision vision) : base(objID, hp) { this.buff = buff; this.vision = vision; }
void Start() { vision = GetComponent <EnemyVision>(); rb = GetComponent <Rigidbody2D>(); anim = transform.GetComponentInChildren <Animator>(); }