Ejemplo n.º 1
0
        void Awake()
        {
            _rigid    = GetComponent <Rigidbody2D>();
            _collider = GetComponent <CapsuleCollider2D>() as Collider2D;

            // Init animation controller
            _animController = GetComponent <PlayerAnimController>() ?? this.transform.gameObject.AddComponent <PlayerAnimController>();
            _animController.Init(this, _bodyAnimator, _faceAnimator);

            // Init Physic Manager
            _physicManager = GetComponent <PlayerPhysicController>() ?? this.transform.gameObject.AddComponent <PlayerPhysicController>();
            _physicManager.Init(this, _rigid);

            _effector = FindObjectOfType <ctw_Effector_behavior>();
            _eraser   = BulletEraser.Create(_eraserPrefab, this.gameObject);

            if (_eraser == null)
            {
                Debug.LogError("eraser가 할당되어 있지 않습니다.");
            }
            if (_effector == null)
            {
                Debug.LogError("effector가 할당되어 있지 않습니다.");
            }

            _mainCamera = CameraManager.Instance.MainCamera;
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Bullet Eraser를 만듭니다.
    /// </summary>
    /// <param name="eraserPrefab">Bullet Eraser가 될 prefab</param>
    /// <param name="following">Bullet Eraser가 따라가야할 gameobject</param>
    /// <returns></returns>
    public static BulletEraser Create(GameObject eraserPrefab, GameObject following)
    {
        GameObject obj = Instantiate(eraserPrefab);

        obj.name = String.Format("{0}_Bullet_Eraser", following.name);
        BulletEraser eraser = obj.GetComponent <BulletEraser>();

        eraser?.Init();
        eraser._followingObj = following;
        return(eraser);
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Boss Behavior 초기화
        /// </summary>
        public virtual void Init()
        {
            OnHit   = new UnityEvent();
            _boss   = GetComponent <BaseBoss>();
            _player = FindObjectOfType <PlayerController>();
            _eraser = BulletEraser.Create(_eraserPrefab, this.gameObject);

            if (_eraser == null)
            {
                Debug.LogWarning("eraser가 할당되지 않았습니다.");
            }
        }