private void Start() { _swipeControls = GetComponent <SwipeControls>(); _tapScreen = GetComponent <TapScreen>(); _menuSounds = GetComponent <MenuSounds>(); //_menuSounds.playSound(0); }
public void SetTouchData(SwipeControls controls) { TouchMovement swipeData = new TouchMovement { StartPos = startPosition, swipeControls = controls }; tData?.Invoke(swipeData); }
public void SetData(SwipeControls controls) { SwipeMovement swipeData = new SwipeMovement { StartPos = startPosition, endPos = endPosition, swipeControls = controls }; data?.Invoke(swipeData); }
public void CreateFight(GameObject other) { enemy = other; CreateSlicer(); CreateTimer(); gameObject.AddComponent <SwipeControls>(); swipeControls = gameObject.GetComponent <SwipeControls>(); swipeControls.slicer = currentSlice; gameObject.AddComponent <Swipe>(); currentSwipe = gameObject.GetComponent <Swipe>(); swipeControls.swipe = currentSwipe; }
private void OnTriggerEnter(Collider col) { SwipeControls sc = col.transform.GetComponent <SwipeControls>(); if (sc == null) { return; } if (col.transform.position.x < 0) { sc.target = new Vector3(-1f, 3f, 0f); sc.ismoving = true; sc.x = 0; sc.stopSL = true; } else if (col.transform.position.x > 0) { sc.target = new Vector3(1f, 3f, 0f); sc.ismoving = true; sc.x = 2; sc.stopSR = true; } }
void Start() { hMenuScript = GameObject.Find("MenuGroup").GetComponent <MenuScript>() as MenuScript; hPatchesRandomizer = this.GetComponent <PatchesRandomizer>() as PatchesRandomizer; hPlayerSidesColliderScript = GameObject.Find("PlayerSidesCollider").GetComponent <PlayerSidesColliderScript>() as PlayerSidesColliderScript; hPlayerFrontColliderScript = GameObject.Find("PlayerFrontCollider").GetComponent <PlayerFrontColliderScript>() as PlayerFrontColliderScript; hSoundManager = GameObject.Find("SoundManager").GetComponent <SoundManager>() as SoundManager; hInGameScript = this.GetComponent <InGameScript>() as InGameScript; hPitsMainController = this.GetComponent <PitsMainController>() as PitsMainController; hCheckPointsMain = this.GetComponent <CheckPointsMain>() as CheckPointsMain; hPowerupScript = this.GetComponent <PowerupsMainController>() as PowerupsMainController; hEnemyController = GameObject.Find("Enemy").GetComponent <EnemyController>() as EnemyController; hPowerupScript = this.GetComponent <PowerupsMainController>() as PowerupsMainController; hCameraController = Camera.main.gameObject.GetComponent <CameraController>() as CameraController; swipeLogic = transform.GetComponent <SwipeControls>() as SwipeControls; tPlayer = transform; tPlayerRotation = transform.Find("PlayerRotation"); playerRenderer = GameObject.Find("rend").GetComponent <SkinnedMeshRenderer>(); //get the animation component of the player character aPlayer = this.transform.Find("PlayerRotation/PlayerMesh/Prisoner").GetComponent <Animation>() as Animation; tBlobShadowPlane = transform.Find("BlobShadowPlane"); tPlayerSidesCollider = GameObject.Find("PlayerSidesCollider").transform; tFrontCollider = GameObject.Find("PlayerFrontCollider").transform; if (!PersistentManagerScript.Instance.obstacles) { tFrontCollider.GetComponent <BoxCollider>().enabled = false; tPlayerSidesCollider.GetComponent <BoxCollider>().enabled = false; } tHUDGroup = GameObject.Find("HUDMainGroup/HUDGroup").transform; tPauseButton = GameObject.Find("HUDMainGroup/HUDGroup/HUDPause").transform; tQuitButton = GameObject.Find("HUDMainGroup/HUDGroup/HUDQuit").transform; tQuitButton.gameObject.active = false; HUDCamera = GameObject.Find("HUDCamera").GetComponent <Camera>(); v3BNCDefaultScale = tFrontCollider.localScale; v3BFCDefaultScale = tPlayerSidesCollider.localScale; bInAir = false; fCurrentDistanceOnPath = 50.0f; //inital distance with respect to spline fCurrentDistance = 0.0f; fCurrentMileage = 0.0f; tCurrentAngle = 0.0f; fPitFallLerpValue = 0.0f; fPitFallForwardSpeed = 0.0f; fPitPositionX = 0.0f; iDeathAnimStartTime = 0; bGroundhit = false; bJumpFlag = false; bInJump = false; fCurrentUpwardVelocity = 0; fCurrentHeight = 0; bDirectionQueueFlag = false; directionQueue = SwipeControls.SwipeDirection.Null; iLanePosition = 0; //set current lane to mid fCurrentWalkSpeed = fStartingWalkSpeed; if (PlayerPrefs.HasKey("ControlsType")) { swipeControlsEnabled = PlayerPrefs.GetInt("ControlsType") == 1 ? true : false; } else { PlayerPrefs.SetInt("ControlsType", (swipeControlsEnabled == true ? 1 : 0)); } hSoundManager.stopSound(SoundManager.CharacterSounds.Footsteps); StartCoroutine("playIdleAnimations"); //start playing idle animations }