Exemplo n.º 1
0
        public void Initializer()
        {
            m_local_player   = InGameManager.Instance.local_player.character;
            hp_text.text     = m_local_player.unit.rank.hp.ToString();
            damage_text.text = m_local_player.unit.rank.damage.ToString();
            speed_text.text  = m_local_player.unit.rank.move_speed.ToString();

            my_main_frame.sprite  = main_frame.sprite;
            my_main_weapon.sprite = main_weapon.sprite;
            my_sub_weapon.sprite  = sub_weapon.sprite;

            my_main_weapon_icon.sprite = my_main_weapon.sprite;
            my_sub_weapon_icon.sprite  = my_sub_weapon.sprite;
        }
Exemplo n.º 2
0
        private void ScanForPlayer()
        {
            if (!PlayerInput.Instance.have_control || InGameManager.Instance.local_player.character == null)
            {
                return;
            }

            CharacterComponent PlayerCharacter = InGameManager.Instance.local_player.character;
            Vector3            dir             = InGameManager.Instance.local_player.character.transform.position - transform.position;

            if (dir.sqrMagnitude > view_distance * view_distance)
            {
                return;
            }

            Vector3 testForward = Quaternion.Euler(0, 0, sprite_face_left ? Mathf.Sign(m_sprite_forward.x) * -view_direction : Mathf.Sign(m_sprite_forward.x) * view_direction) * m_sprite_forward;

            float angle = Vector3.Angle(testForward, dir);

            if (angle > view_fov * 0.5f)
            {
                return;
            }

            m_target = PlayerCharacter.transform;

            if (!m_is_target_in)
            {
                CancelInvoke("MoveRandom");

                if (m_target.position.x <= transform.position.x)
                {
                    m_next_move = !sprite_face_left ? 1 : -1;
                }
                else
                {
                    m_next_move = sprite_face_left ? 1 : -1;
                }
            }
        }
Exemplo n.º 3
0
        private void Awake()
        {
            m_transform       = transform;
            m_sprite_renderer = GetComponent <SpriteRenderer>();
            m_character       = GetComponent <CharacterComponent>();

            if (m_sprite_renderer == null)
            {
                m_sprite_renderer = GetComponentInChildren <SpriteRenderer>();
            }

            if (m_sprite_renderer != null)
            {
                if (sprite_face_left)
                {
                    m_origin_flip = !m_sprite_renderer.flipX;
                }
                else
                {
                    m_origin_flip = m_sprite_renderer.flipX;
                }
            }
        }
Exemplo n.º 4
0
        void Awake()
        {
            m_chracter             = GetComponent <CharacterComponent>();
            m_character_controller = GetComponent <CharacterController2D>();
            m_sprite_renderer      = GetComponent <SpriteRenderer>();
            m_animator             = GetComponent <Animator>();
            m_damager = GetComponent <Damager>();

            m_sprite_forward = sprite_face_left ? Vector2.left : Vector2.right;
            if (m_sprite_renderer.flipX)
            {
                m_sprite_forward = -m_sprite_forward;
            }

            if (is_random_dir)
            {
                MoveRandom();
            }
            else
            {
                m_next_move = Random.Range(-1, 2);
            }
        }
Exemplo n.º 5
0
        private void Awake()
        {
            m_CharacterController2D = GetComponent <CharacterController2D>();
            m_Collider       = GetComponent <Collider2D>();
            m_Animator       = GetComponent <Animator>();
            m_SpriteRenderer = GetComponent <SpriteRenderer>();

            m_OriginalColor = m_SpriteRenderer.color;
            test_char       = GetComponent <CharacterComponent>();

            //if(projectilePrefab != null)
            //m_BulletPool = BulletPool.GetObjectPool(projectilePrefab.gameObject, 8);

            m_SpriteForward = spriteFaceLeft ? Vector2.left : Vector2.right;
            if (m_SpriteRenderer.flipX)
            {
                m_SpriteForward = -m_SpriteForward;
            }

            if (meleeDamager != null)
            {
                EndAttack();
            }
        }
Exemplo n.º 6
0
 private void SetCharacter(CharacterComponent _character)
 {
     character = _character;
     camera_cinemachine.Follow = _character.transform;
 }
Exemplo n.º 7
0
 /// <summary>
 /// 플레이어에게 선택한 캐릭터를 연결 시킵니다.
 /// </summary>
 /// <param name="_character">플레이어와 연결 시킬 케릭터</param>
 public void Possess(CharacterComponent _character)
 {
     SetCharacter(_character);
 }