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
    void Start()
    {
        PlayerTransform = GetComponent <Transform>();
        PlayerRigid2D   = GetComponent <Rigidbody2D>();
        PlayerCollider  = GetComponent <PolygonCollider2D>() as Collider2D;
        PlayerSprite    = GetComponent <SpriteRenderer>();

        Eraser = GameObject.Find("ctw_Eraser_Player").GetComponent <ctw_Eraser_behavior>();

        MainCamera = GameObject.Find("ctw_Main Camera").GetComponent <Camera>();

        CameraScript = MainCamera.GetComponent <ctw_Camera_behavior>();

        Effect = GameObject.Find("ctw_Effector").GetComponent <ctw_Effector_behavior>();
    }