Exemplo n.º 1
0
 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;
 }
Exemplo n.º 3
0
 private void Awake()
 {
     _animator       = GetComponent <Animator>();
     _rigidbody      = GetComponent <Rigidbody2D>();
     _player         = GameObject.FindWithTag("Player");
     _currentTarget  = _player.GetHashCode();
     _agent          = GetComponent <SAP2DAgent>();
     _gameController = FindObjectOfType <GameController>();
 }
Exemplo n.º 4
0
 void Start()
 {
     ai               = GetComponent <SAP2DAgent> ();
     player           = FindObjectOfType <Miner> ();
     ai.MovementSpeed = Random.Range(50, 70);
     if (player != null)
     {
         ai.Target = player.transform.Find("Target").transform;
     }
 }
Exemplo n.º 5
0
    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;
        }
Exemplo n.º 7
0
    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();
    }
Exemplo n.º 8
0
 void Start()
 {
     _sAP2DAgent = GetComponent <SAP2DAgent>();
 }