private void Start() { ValidateSerialisedFields(); gameController = GameObject.FindWithTag("GameController").GetComponent <GameController>(); cameraEdge = Camera.main.GetComponent <CameraEdge>(); SpawnEnnemies(); }
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>(); }
void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject != null) { CameraEdge pCE = collision.gameObject.GetComponent <CameraEdge>(); if (pCE != null) { PlayerManager.getInstance().GetGameCamera().RecoveryDown(); } } }
// 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); } }
public void AddEdge(CameraEdge cameraEdge) { Edges.Add(cameraEdge); RemakeBounds(); }