Exemplo n.º 1
0
    void Awake()
    {
        main = this;
        ChangeState <IdleState>(null);
        haloView      = GetComponentInChildren <HaloView>();
        blockMovement = BlockMovement.AddBlockMovement(gameObject, airBox, solidLayer);
        blockMovement.staticExtrusion = true;
        jumpSkill.Init(() => Input.GetButton("Jump"), this);
        rushSkill.Init(() => Input.GetButton("Rush"), this);
        swapSkill.Init(() => Input.GetButton("Swap"), this);
        swapCharges.Init(this);
        //swap energe update
        StartCoroutine(SwapDetect());
        cameraEdge           = new CameraEdge();
        cameraEdge.edge      = GameObject.Find("SceneEdge").GetComponent <BoxCollider2D>();
        cameraEdge.cameraPos = CameraPos.main;

        follow           = new CameraSmoothFollow();
        follow.mainPos   = true;
        follow.posGetter = () => cameraEdge.UpdatePos(blockMovement.Position);
        //follow.posGetter = () => blockMovement.Position;
        follow.distanceSpeedCurve = followDistanceSpeedCurve;
        follow.priority           = 2;
        follow.Register(this);
        playerPosDisQueue = new PositionDistanceQueue(() => PositionWithoutHalo
                                                      , posQueueDisMax
                                                      , posQueueCountMax);
        StartCoroutine(playerPosDisQueue.Update());

        scaleAd = ApCtrl.CreateAlphaData(ApCtrl.TransformScaleXY(transform), this);
        StartCoroutine(TransforDetect());

        sound = GetComponentInChildren <AudioSource>();
    }