Пример #1
0
    private void Awake()
    {
        //주인공 게임 오브젝트 추출
        var player = GameObject.FindGameObjectWithTag("Player");

        //주인공의 트렌스폼 컨포넌트 추출
        if (player != null)
        {
            playerTr = player.GetComponent <Transform>();
        }
        //적 캐릭터의 트렌스폼 컨포넌트 추출
        enemyTr = GetComponent <Transform>();
        //Animator 컴포넌트 추출
        animator = GetComponent <Animator>();
        //이동을 제어하는 MoveAgent 클래스를 추출
        moveAgent = GetComponent <MoveAgent>();
        //총알 발사를 제어하는 EnemyFire 클래스를 추출
        enemyFire = GetComponent <EnemyFire>();
        enemyFOV  = GetComponent <EnemyFOV>();
        //코루틴 지연시간 생성
        ws = new WaitForSeconds(0.3f);

        animator.SetFloat(hashOffset, Random.Range(0.0f, 1.0f));
        animator.SetFloat(hashWalkSpeed, Random.Range(1.0f, 1.2f));
    }
Пример #2
0
    void Awake()
    {
        //Player GameObject 추출
        var player = GameManager.instance.Player;

        //Player와 Enemy의 Transform 추출
        if (player != null)
        {
            playerTr = player.GetComponent <Transform>();
            playerLv = player.GetComponent <PlayerLv>();
        }
        enemyTr = GetComponent <Transform>();
        //Anumator 추출
        animator = GetComponent <Animator>();
        //MoveAgent 추출
        moveagent = GetComponent <MoveAgent>();
        //EnemyFire 추출
        enemyFire = GetComponent <EnemyFire>();
        //EnemyFOV 추출
        enemyFOV = GetComponent <EnemyFOV>();

        //코루틴 지연 시간
        ws = new WaitForSeconds(0.3f);

        //Offset값과 Speed 값을 불규칙하게 변경
        animator.SetFloat(hashOffset, Random.Range(0.0f, 1.0f));
        animator.SetFloat(hashwalkSpeed, Random.Range(1.0f, 1.2f));
    }
Пример #3
0
    void Awake()
    {
        //주인공 게임오브젝트 추출
        var player = GameObject.FindGameObjectWithTag("PLAYER");

        //주인공의 TRANSFORM 컴포넌트 추출
        if (player != null)
        {
            playerTr = player.GetComponent <Transform>();
        }
        //적 캐릭터의 Transform 컴포넌트 추출
        enemyTr = GetComponent <Transform>();

        //적 캐릭터의 Transform 컴포넌트를 추출
        animator = GetComponent <Animator>();


        //이동을 제어하는 MoveAgent 클래스를 추출
        moveAgent = GetComponent <MoveAgent>();

        //총알 발사를 제어하는 EnemyFire 클래스를 추출
        enemyFire = GetComponent <EnemyFire>();

        //코루틴의 지연 시간 생성1
        ws = new WaitForSeconds(0.3f);

        //Cycle Offset 값을 불규칙하게 변경
        animator.SetFloat(hashOffset, Random.Range(0.0f, 1.0f));

        //WalkSpeed 값을 불규칙하게 변경
        animator.SetFloat(hashWalkSpeed, Random.Range(1.0f, 1.2f));
    }
Пример #4
0
 void Awake()
 {
     cachedTransform = GetComponent <Transform>();
     myAni           = GetComponent <MonsterAni>();
     myParams        = GetComponent <MonsterParams>();
     moveAgent       = GetComponent <MoveAgent>();
 }
Пример #5
0
    private void Awake()
    {
        var player = GameObject.FindGameObjectWithTag("PLAYER");

        if (player != null)
        {
            playerTr = player.GetComponent <Transform>();
        }
        gManager  = GameObject.Find("GameManager").GetComponent <GameManager>();
        enemyTr   = GetComponent <Transform>();
        moveAgent = GetComponent <MoveAgent>();
        erAttack  = GetComponent <EnemyRangeAttack>();
        bManager  = GameObject.FindGameObjectWithTag("BUILD").GetComponent <BuildManager>();
        if (GameObject.Find("SpawnManager") != null)
        {
            sManager = GameObject.Find("SpawnManager").GetComponent <SpawnManager>();
        }
        if (GameObject.Find("GraveSpawnManager") != null)
        {
            gsManager = GameObject.Find("GraveSpawnManager").GetComponent <GraveSpawnManager>();
        }
        uiManager = GameObject.Find("UIManager").GetComponent <UIManager>();
        animator  = GetComponent <Animator>();
        wSecond   = new WaitForSeconds(0.2f);
    }
Пример #6
0
    void Awake()
    {
        //주인공 게임오브젝트 추출
        var player = GameObject.FindGameObjectWithTag("PLAYER");

        //주인공의 Tranform 컴포넌트 추출
        if (player != null)
        {
            playerTr = player.gameObject.GetComponent <Transform>();
        }

        //적 캐릭터의 Tranform 컴포넌트 추출
        enemyTr = GetComponent <Transform>();
        //Animator 컴포넌트 추출
        animator = GetComponent <Animator>();
        //이동을 제어하는 MoveAgent 클래스를 추출
        moveAgent = GetComponent <MoveAgent>();
        //공격을 제어하는 EnemyAttack클래스 추출
        enemyAttack = GetComponent <EnemyAttack>();
        enemySound  = GetComponent <EnemySound>();
        //코루틴의 지연시간 생성
        ws = new WaitForSeconds(0.3f);

        //Cycle Offset 값을 불규칙하게 변경
        animator.SetFloat(hashOffset, Random.Range(0f, 1f));
        animator.SetFloat(hashWalkSpeed, Random.Range(1f, 1.2f));
    }
Пример #7
0
    void Awake()
    {
        var player = GameObject.FindGameObjectWithTag("PLAYER");

        if (player != null)
        {
            playerTr = player.GetComponent <Transform>();
        }

        enemyTr = GetComponent <Transform>();

        animator = GetComponent <Animator>();

        moveAgent = GetComponent <MoveAgent>();

        enemyFire = GetComponent <EnemyFire>();

        enemyFOV = GetComponent <EnemyFOV>();

        ws = new WaitForSeconds(0.3f);

        animator.SetFloat(hashOffset, Random.Range(0.0f, 1.0f));

        animator.SetFloat(hashWalkSpeed, Random.Range(1.0f, 1.2f));
    }
    public List <Node> GetPath(TSVector2 startPosition, TSVector2 targetPosition, MoveAgent agent)
    {
        _agent = agent;
        Node startNode  = GetNodeFromPoint((int)startPosition.x, (int)startPosition.y);
        Node targetNode = GetNodeFromPoint((int)targetPosition.x, (int)targetPosition.y);

        return(_path.GetPath(startNode, targetNode));
    }
 void Start()
 {
     playerTr  = GameObject.FindGameObjectWithTag("PLAYER").GetComponent <Transform>();
     uiManager = GameObject.Find("UIManager").GetComponent <UIManager>();
     enemyTr   = GetComponent <Transform>();
     agent     = GetComponent <MoveAgent>();
     animator  = GetComponent <Animator>();
 }
Пример #10
0
 void Start()
 {
     playerTr = GameObject.FindGameObjectWithTag("PLAYER").GetComponent <Transform>();
     friendTr = GetComponent <Transform>();
     agent    = GetComponent <MoveAgent>();
     bManager = GameObject.Find("Build").GetComponent <BuildManager>();
     gravity  = 9.81f;
     _height  = 5.0f;
 }
Пример #11
0
 private void Awake()
 {
     player    = GameObject.FindGameObjectWithTag("PLAYER");
     playerTr  = GameObject.FindGameObjectWithTag("PLAYER").transform;
     agent     = GetComponent <MoveAgent>();
     frAttack  = GetComponent <FriendAttack>();
     uiManager = GameObject.Find("UIManager").GetComponent <UIManager>();
     wSecond   = new WaitForSeconds(0.5f);
 }
Пример #12
0
    private void Awake()
    {
        moveAgent = GetComponent <MoveAgent>();
        animator  = GetComponent <Animator>();
        enemyFire = GetComponent <EnemyFire>();
        enemyFOV  = GetComponent <EnemyFOV>();

        animator.SetFloat(hashOffset, Random.Range(0, 1.0f));
        animator.SetFloat(hashWalkSpeed, Random.Range(1.0f, 1.2f));
    }
 void Start()
 {
     playerTr  = GameObject.FindGameObjectWithTag("PLAYER").GetComponent <Transform>();
     enemyTr   = GetComponent <Transform>();
     agent     = GetComponent <MoveAgent>();
     bManager  = GameObject.Find("Build").GetComponent <BuildManager>();
     uiManager = GameObject.Find("UIManager").GetComponent <UIManager>();
     animator  = GetComponent <Animator>();
     gravity   = 9.81f;
     _height   = 8.0f;
 }
Пример #14
0
        protected virtual void Awake()
        {
            _moveAgent = GetComponent <MoveAgent>();
            _damager   = GetComponent <Damager>();
            _damagable = GetComponent <Damagable>();

            _moveAgent.PassIsPassed += BaseIsReached;
            _damagable.died         += OnMonsterDied;

            monsterDied += LevelManager.Instance.PlayerBank.AddGold;
        }
Пример #15
0
    void Awake()
    {
        player = GameObject.FindGameObjectWithTag("Player");

        ani       = GetComponent <Animator>();
        moveAgent = GetComponent <MoveAgent>();

        waitSeconds = new WaitForSeconds(refreshAICycle);
        pCtrl       = player.GetComponent <PlayerCtrl>();

        ea    = GetComponent <EnemyAttack>();
        eItem = GetComponent <EnemyItem>();
    }
    void SpwanPlayer(int playerId)
    {
        MessageProtocol message = new MessageProtocol("Spwaning @ " + playerId)
        {
            from_client = GameData.GAME_CLIENT_NAME
        };

        SocketClient.ActiveSocket.QueueLocalMessage(message);

        MoveAgent player = Instantiate <MoveAgent>(playerPrefab, spwanPoints[playerId].position, Quaternion.identity);

        player.PlayerId = playerId;
    }
Пример #17
0
    private void Awake()
    {
        init = this;

        dieEffect   = Resources.Load <GameObject>("monsterDead");
        playerTr    = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        enemyTr     = GetComponent <Transform>();
        moveAgent   = GetComponent <MoveAgent>();
        animator    = GetComponent <Animator>();
        _audio      = GetComponent <AudioSource>();
        attackRange = this.transform.Find("attackRange");

        stateCheck_time = new WaitForSeconds(0.3f);
    }
Пример #18
0
    protected override void Awake()
    {
        base.Awake();
        ES = (EnemyStat)BaseStat;

        fieldOfView = GetComponent <FieldOfView>();
        CA          = GetComponent <CharacterAudios>();
        moveAgent   = GetComponent <MoveAgent>();
        animator    = GetComponent <Animator>();
        audioPlayer = GetComponent <AudioSource>();

        fireDistance  = BulletCtrl._bulletMaxDistance;
        traceDistance = fieldOfView.viewRadius;         // 추적 거리를 시야범위로 초기화
    }
Пример #19
0
 protected override void Awake()
 {
     base.Awake();
     if (_firePorts != null)
     {
         _firePoints = new Transform[(int)EnumEquipSlot.MAX];
         for (int i = 0; i < _firePoints.Length; i++)
         {
             string node = "a";
             char   b    = (char)('a' + i);
             node = node.Replace('a', b);
             GameObject gb = Utils.GetNode(node, ThisObject);
             if (gb != null)
             {
                 _firePoints[i] = gb.transform;
             }
         }
     }
     ObjectID.ObjectType = FC_OBJECT_TYPE.OBJ_BULLET;
     _bulletDisplayers   = ThisObject.GetComponents <BulletDisplayer>();
     if (_agents != null)
     {
         _moveAgent = _agents.GetComponent <MoveAgent>();
         if (_moveAgent != null)
         {
             _moveAgent.Init(this);
         }
     }
     _attackInfo._hitType    = AttackHitType.HurtTiny;
     _attackInfo._damageType = FC_DAMAGE_TYPE.NONE;
     _attackInfo._effectTime = 4f;
     if (_firePorts != null)
     {
         int i = 0;
         foreach (RangerAgent.FirePort fr in _firePorts)
         {
             fr.RefreshPorts(this);
             if (fr._portName == _firePortLifeOver)
             {
                 _firePortLifeOverIdx = i;
             }
             if (fr._portName == _firePortLifeIn)
             {
                 _firePortLifeInIdx = i;
             }
             i++;
         }
     }
 }
Пример #20
0
    void Awake()
    {
        var player = GameObject.FindGameObjectWithTag("Player");

        if (player != null)
        {
            playerTr = player.GetComponent <Transform>();
        }

        enemyTr   = GetComponent <Transform>();
        animator  = GetComponent <Animator>();
        moveAgent = GetComponent <MoveAgent>();

        ws = new WaitForSeconds(0.3f);
    }
Пример #21
0
    private void Awake()
    {
        // Player 오브젝트를 씬에서 찾음
        var playerObject = GameObject.FindGameObjectWithTag("Player");

        if (playerObject != null)
        {
            playerTransform = playerObject.GetComponent <Transform>();
        }

        moveAgent = GetComponent <MoveAgent>();
        animator  = GetComponent <Animator>();
        enemyFire = GetComponent <EnemyFire>();
        enemyFOV  = GetComponent <EnemyFOV>();

        waitSecond = new WaitForSeconds(refreshAICycle);
    }
Пример #22
0
    void Awake()
    {
        playerTr = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        sense    = GetComponent <BokoblinSense>();
        state    = GetComponent <BokoblinState>();
        attack   = GetComponent <BokoblinAttack>();
        agent    = GetComponent <MoveAgent>();
        ani      = GetComponent <BokoblinAnimationCtrl>();
        uiCtrl   = GetComponent <EnemyUICtrl>();
        ragdolls = GetComponentsInChildren <Rigidbody>();
        foreach (Rigidbody bone in ragdolls) // 시작시 래그돌과 콜라이더를 꺼준다
        {
            if (bone.GetComponent <Rigidbody>() != GetComponent <Rigidbody>())
            {
                if (!bone.CompareTag("Weapon"))
                {
                    bone.isKinematic = true;
                    bone.GetComponent <Collider>().enabled = false;
                }
            }
        }

        (root = Selector.Make()).
        AddChild(ActionNode.Make(CheckState)).
        // 전투
        AddChild(Sequence.Make().
                 AddChild(ActionNode.Make(IsAlert)).
                 AddChild(ActionNode.Make(CheckMoveToFoe)).
                 AddChild(ActionNode.Make(AttackFoe)).
                 AddChild(ActionNode.Make(CheckFoeDead))
                 ).
        // 의심
        AddChild(Selector.Make().
                 AddChild(ActionNode.Make(IsAlert)).
                 AddChild(ActionNode.Make(SenseFoe))
                 ).
        // 유휴
        AddChild(Selector.Make().
                 AddChild(ActionNode.Make(IsAlert)).
                 AddChild(ActionNode.Make(Idle))
                 );
    }
Пример #23
0
    void Awake()
    {
        var player = GameObject.FindGameObjectWithTag("PLAYER"); //주인공 게임오브젝트 추출

        if (player != null)
        {
            playerTr = player.GetComponent <Transform>(); //주인공 Transform 추출
        }
        enemyTr   = GetComponent <Transform>();           // 적 Transform 추출
        animator  = GetComponent <Animator>();
        moveAgent = GetComponent <MoveAgent>();
        enemyFire = GetComponent <EnemyFire>();
        audio     = GetComponent <AudioSource>();

        ws = new WaitForSeconds(0.3f); //코루틴 지연시간 생성

        //AI별로 다른 움직임을 가지기 위한 불규칙성 부여
        animator.SetFloat(hashOffset, UnityEngine.Random.Range(0.0f, 1.0f));    //Cycle offset 값을 불규칙하게 변경
        animator.SetFloat(hashWalkSpeed, UnityEngine.Random.Range(1.0f, 1.2f)); //Speed값을 불규칙하게 변경
    }
Пример #24
0
    private void Awake()
    {
        //주인공 게임 오브젝트 호출
        var player = GameObject.FindGameObjectWithTag("Player");

        //주인공의 Transform 컴포넌트 추출
        if (player != null)
        {
            playerTr = player.GetComponent <Transform>();
        }
        //적 캐릭터의 Transform 컴포넌트 추출
        enemyTr = GetComponent <Transform>();

        //이동을 제어하는 MoveAgent클래스를 추출
        moveAgent = GetComponent <MoveAgent>();

        //Animator 컴포넌트 추출
        animator = GetComponent <Animator>();
        //코루틴의 지연시간 생성
        ws = new WaitForSeconds(0.3f);
        //총알 발사를 제어하는 EnemyFire 클래스를 추출
        enemyFire = GetComponent <EnemyFire>();
    }
Пример #25
0
 public override void OnAwake()
 {
     _agent = new MoveAgent();
 }
Пример #26
0
 private void Awake()
 {
     moveAgent   = GetComponent <MoveAgent>();
     animator    = GetComponent <Animator>();
     enemyAttack = GetComponent <EnemyAttack>();
 }
Пример #27
0
 // Start is called before the first frame update
 void Start()
 {
     pos = new Vector2(1, 1);
     ma  = Component.FindObjectOfType <MoveAgent>();
     gs  = GameObject.FindGameObjectWithTag("SceneController").gameObject.GetComponent <gridScript>();
 }
Пример #28
0
 private void Awake()
 {
     moveAgent = GetComponent <MoveAgent>();
     anim      = gameObject.GetComponent <Animator>();
 }
Пример #29
0
 // Use this for initialization
 public Unit (Vector2 coord, PlayerManager player, ResourceController jobController) {
     this.player = player;
     this.jobController = jobController;
     moveAgent = new MoveAgent(1.5f, coord, player, this);
 }
Пример #30
0
 void Start()
 {
     agent     = parent.GetComponent <NavMeshAgent>();
     moveAgent = parent.GetComponent <MoveAgent>();
 }