void Start() { _id = GRANNY_COUNTER; _sAP2DAgent = GetComponent <SAP2DAgent>(); _sAP2DAgent.MovementSpeed = SPEED; _animator = GetComponent <Animator>(); }
void Start() { current_target_index = 0; ownRb = GetComponent <Rigidbody2D>(); agent = GetComponent <SAP2DAgent>(); agent.MovementSpeed = moveSpeed; agent.Target = targets[current_target_index]; player = GameManager.instance.player.transform; }
private void Awake() { _animator = GetComponent <Animator>(); _rigidbody = GetComponent <Rigidbody2D>(); _player = GameObject.FindWithTag("Player"); _currentTarget = _player.GetHashCode(); _agent = GetComponent <SAP2DAgent>(); _gameController = FindObjectOfType <GameController>(); }
void Start() { ai = GetComponent <SAP2DAgent> (); player = FindObjectOfType <Miner> (); ai.MovementSpeed = Random.Range(50, 70); if (player != null) { ai.Target = player.transform.Find("Target").transform; } }
protected override void Start() { state = EnemyState.Default; player = GameManager.instance.player.transform; current_target_index = 0; ownRb = GetComponent <Rigidbody2D>(); agent = GetComponent <SAP2DAgent>(); agent.MovementSpeed = moveSpeed; current_target = targets[current_target_index]; agent.Target = current_target; tempRotateSpeed = agent.RotationSpeed; checkSafeAreaOrNot = true; base.Start(); }
// The start function will initialize our member variables. void Start() { // Get the game objects for hurt and death noises. this.HurtNoise = GameObject.Find("SwarmlingHurtNoise"); this.DeathNoise = GameObject.Find("SwarmlingDeathNoise"); this.LaserNoise = gameObject.GetComponent <AudioSource>(); this.Depots = new Collection <Transform>(); this.Agent = this.gameObject.GetComponent <SAP2DAgent>(); var depots = GameObject.FindGameObjectsWithTag("Depot"); this.DefaultPositions = new Vector2[depots.Length]; for (var i = 0; i < depots.Length; i++) { this.DefaultPositions[i] = new Vector2(depots[i].transform.position.x, depots[i].transform.position.y); this.Depots.Add(depots[i].transform); } // this.CurrentCommand = ScriptableObject.CreateInstance<???>(); this.CurrentHealth = this.MaxHealth; // Get the player's posiiton. this.PlayerTarget = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); Debug.Assert(this.PlayerTarget != null); this.Target = this.PlayerTarget; float step = this.Speed * Time.deltaTime; // Default path: move towards Default 0. DefaultIdx = this.GetRandomPositionID(); this.PrevDefaultIdx = this.DefaultIdx; this.Destination = DefaultPositions[DefaultIdx]; this.destPoint = 0; this.path = null; path = Pathfinder.FindPath(transform.position, this.Destination, Config); // Time for intermittent attacks. this.ElapsedTime = 0; this.CurrentDepot = this.GetRandomDepot(); this.Agent.Target = this.Depots[this.CurrentDepot]; this.SearchingDepot = true; }
protected override void Start() { player = GameManager.instance.player.transform; ownRb = GetComponent <Rigidbody2D>(); originalRotation = ownRb.rotation; tempOriginalRotation = originalRotation; current_target = targets[0]; state = EnemyState.Default; agent = GetComponent <SAP2DAgent>(); agent.MovementSpeed = 0; agent.Target = null; agent.enabled = false; tempRotateSpeed = agent.RotationSpeed; checkSafeAreaOrNot = true; base.Start(); }
void Start() { _sAP2DAgent = GetComponent <SAP2DAgent>(); }