コード例 #1
0
 private void Awake()
 {
     _aiFieldOfView = GetComponent <AiFieldOfView>();
     _aiPathfinding = GetComponent <AiPathfinding>();
     _aiAttack      = GetComponent <AiAttack>();
     _animator      = GetComponent <Animator>();
 }
コード例 #2
0
ファイル: EnemyHealth.cs プロジェクト: duriumm/Pixel-Game
 public override void Start()
 {
     base.Start();
     spriteRenderer          = GetComponent <SpriteRenderer>();
     enemyAttack             = gameObject.GetComponent <AiAttack>();
     enemyMovement           = gameObject.GetComponent <AiMovement>();
     colliderList            = gameObject.GetComponentsInChildren <Collider2D>();
     dataToPassBetweenScenes = GameObject.FindGameObjectWithTag("PassData").GetComponent <DataToPassBetweenScenes>();
     player = GameObject.Find("MyCharacter");
 }
コード例 #3
0
ファイル: RangeFinder.cs プロジェクト: GL1TCH3D94/rush
    // Update is called once per frame
    void Update()
    {
        distance     = (enemy.position - player.position);
        distance.y   = 0;
        distanceFrom = distance.magnitude;
        distance    /= distanceFrom;


        if (distanceFrom < 20)
        {
            ProgressAlongPathSpeed speed  = GetComponent <ProgressAlongPathSpeed>();
            ProgressAlongPathTime  time   = GetComponent <ProgressAlongPathTime>();
            RotateToMovement       rotate = GetComponent <RotateToMovement>();
            AiAttack attack = GetComponent <AiAttack>();
            AIMove   move   = GetComponent <AIMove>();

            speed.enabled  = false;
            time.enabled   = false;
            rotate.enabled = false;
            attack.enabled = true;
            move.enabled   = true;
        }
        else
        {
            ProgressAlongPathSpeed speed  = GetComponent <ProgressAlongPathSpeed>();
            ProgressAlongPathTime  time   = GetComponent <ProgressAlongPathTime>();
            RotateToMovement       rotate = GetComponent <RotateToMovement>();
            AiAttack attack = GetComponent <AiAttack>();
            AIMove   move   = GetComponent <AIMove>();

            speed.enabled  = true;
            time.enabled   = true;
            rotate.enabled = true;
            attack.enabled = false;
            move.enabled   = false;
        }
    }
コード例 #4
0
 void Awake()
 {
     Player       = GameObject.FindWithTag("Player").transform;
     _enemyattack = GetComponent <AiAttack>();
     rb           = GetComponent <Rigidbody>();
 }