コード例 #1
0
 private void Start()
 {
     ValidateSerialisedFields();
     gameController = GameObject.FindWithTag("GameController").GetComponent <GameController>();
     cameraEdge     = Camera.main.GetComponent <CameraEdge>();
     SpawnEnnemies();
 }
コード例 #2
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>();
    }
コード例 #3
0
ファイル: CameraStopDown.cs プロジェクト: woym2008/Oberon
 void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject != null)
     {
         CameraEdge pCE = collision.gameObject.GetComponent <CameraEdge>();
         if (pCE != null)
         {
             PlayerManager.getInstance().GetGameCamera().RecoveryDown();
         }
     }
 }
コード例 #4
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         CameraEdge edge = Camera.main.GetComponent <CameraEdge>();
         Destroy(enterGameText);
         Vector2 spawnPos = new Vector2(
             Random.Range(-edge.Width / 2, edge.Width / 2),
             Random.Range(-edge.Height / 2, edge.Height / 2));
         Instantiate(playerPrefab, spawnPos, Quaternion.identity);
         Destroy(this.gameObject);
     }
 }
コード例 #5
0
ファイル: CameraFrame.cs プロジェクト: Dracir/FRC_AutoPlanner
 public void AddEdge(CameraEdge cameraEdge)
 {
     Edges.Add(cameraEdge);
     RemakeBounds();
 }