void Start() { playertouch = GetComponent <PlayerTouch>(); generator = GetComponent <Generator>(); loseScoreText = LoseScore.GetComponent <Text>(); isLose = false; }
private void ProcessPlayerTouchData(PlayerTouch _touch) { if (_touch.moved && _touch.selectedChar != null) { _touch.selectedChar.Selected = false; _touch.selectedChar.ProcessNewPath(_touch); } }
// Use this for initialization void Start() { playerTouch = FindObjectOfType <PlayerTouch>(); score = FindObjectOfType <Score>(); increaseRate = 0.15f; spawnTimer = timeToSpawn; }
private void ResetTouch(PlayerTouch _touch) { //Debug.Log("Resetting touch"); _touch.tracking = false; _touch.moved = false; _touch.selectedChar = null; _touch.touchStart = Vector3.zero; _touch.touchEnd = Vector3.zero; }
// Start is called before the first frame update void Start() { mainCamera = FindObjectOfType <Camera>(); PTouch = new PlayerTouch[5]; for (int i = 0; i < 5; ++i) { PTouch[i] = new PlayerTouch(); } }
private void OnTriggerExit(Collider other) { if (other.tag == "PlayerBodyTrigger" && canActivate) { Debug.Log("Leaving switch"); playerTouch.SwitchAnimationEnd.RemoveListener(TriggerSwitchEvent); playerTouch = null; canActivate = false; } }
private void OnTriggerEnter(Collider other) { if (other.tag == "PlayerBodyTrigger" && !canActivate) { Debug.Log("Arriving at switch"); playerTouch = other.transform.parent.GetComponent <PlayerTouch>(); playerTouch.SwitchAnimationEnd.AddListener(TriggerSwitchEvent); canActivate = true; } }
// Use this for initialization void Start() { Player.Score = 0; playerStatus = Status.playing; transform.position = new Vector3(0, -50, 150); transform.eulerAngles = Vector3.zero; playerTouch = this.GetComponent <PlayerTouch>(); CurrentAngel = transform.eulerAngles; TargetAngel = Vector3.zero; }
// Use this for initialization void Start() { if (this.name != "Mira") { mira = GameObject.FindGameObjectWithTag("Mira").GetComponent <PlayerTouch>() as PlayerTouch; } animator = player.GetComponent <Animator> (); LineRenderer line = gameObject.AddComponent <LineRenderer>(); line.SetWidth(0.0f, 0.0f); line.material = mat; line.sortingLayerName = "ForenGround"; }
// Start is called before the first frame update void Start() { playerTransform = GameObject.FindWithTag("Player").transform; if (playerTransform == null) { Debug.LogError("Must have a player in the scene."); } playerMovement = playerTransform.GetComponent <PlayerMovement>(); characterTransform = playerTransform.Find("Character"); // if (playerTransform.Find("Character").tag != "Player") // { // characterTransform.tag = "Player"; // } playerTouch = characterTransform.GetComponent <PlayerTouch>(); playerTouch.DeathAnimationEnd.AddListener(respawnPlayer); respawnPosition = initialRespawnPosition.position; }
// Start is called before the first frame update void Start() { character = transform.Find("Character"); myRigidbody = character.GetComponent <Rigidbody>(); playerTouch = character.GetComponent <PlayerTouch>(); animator = character.GetComponent <Animator>(); if (speed <= 0) { speed = 1f; } if (jumpForce <= 0) { jumpForce = 8f; } if (jumpTime <= 0) { jumpTime = 0.3f; } // Yet another small change timer = jumpTime + 1; alive = true; playerTouch.OffTheGround.AddListener(JumpStartForce); //playerTouch.DeathTouch.AddListener(Death); -> relegated to Game Manager playerTouch.StandUpAnimationEnd.AddListener(RegainMovement); playerTouch.PunchAnimationEnd.AddListener(RegainPunch); Transform gndTrigger = character.Find("GndTrigger"); gndDetector = gndTrigger.GetComponent <GroundDetector>(); gndDetector.BackToGround.AddListener(BackFromJump); Transform bdyTrigger = character.Find("BdyTrigger"); bdyDetector = bdyTrigger.GetComponent <BodyDetector>(); bdyDetector.NearSwitch.AddListener(NearSwitch); bdyDetector.AwayFromSwitch.AddListener(AwayFromSwitch); bdyDetector.EnterSunlight.AddListener(ActivateSunlight); //bdyDetector.LeaveSunlight.AddListener(DeactivateSunlight); Transform fntTrigger = character.Find("FntTrigger"); fntDetector = fntTrigger.GetComponent <FrontDetector>(); fntDetector.EnterPushable.AddListener(() => { /*Debug.Log("Can Push");*/ pushing = true; }); fntDetector.LeavePushable.AddListener(() => { /*Debug.Log("Cannot Push");*/ pushing = false; }); }
private void UpdateTouchInput() { for (int i = 0; i < Input.touchCount; i++) { if (!IsTouchAlreadyBeingTracked(Input.GetTouch(i)) && IsEmployeeAtThisPosition(Input.GetTouch(i).position)) { PlayerTouch newTouch = GetNewTouch(); if (newTouch == null) { Debug.LogWarning("No free touches! Increase max touch count or stop touching the screen"); continue; } newTouch.data = Input.GetTouch(i); newTouch.tracking = true; newTouch.touchStart = newTouch.data.position; newTouch.worldStart = TouchToWorldspace(newTouch.touchStart); newTouch.selectedChar = toAssign; newTouch.selectedChar.Selected = true; toAssign = null; } } UpdateEmployeeTouches(); }
/* * public void addTouch(int touchNr, string colorTouched, Player player = null) * { * PlayerTouch lastTouch = new PlayerTouch(me, PMTimeManager.GetTimeStamp(), colorTouched); * mainPattern.Insert(touchNr, lastTouch); * PMTextManager.PrintToPlayer(stringedMainPattern(0, true)); * printMainPattern("last"); * PMTurnDirector.GameStep = TurnDirector.GameState.G_EndTurn; * } * * public void compareTouch(int touchNr, string colorTouched, Player player = null) * { * PlayerTouch rTouch = new PlayerTouch(me, PMTimeManager.GetTimeStamp(), colorTouched); * repeatPattern.Insert(touchNr, rTouch); * //repeatPattern.Add(rTouch); * if (repeatPattern[touchNr].ColorTouched == mainPattern[touchNr].ColorTouched && * repeatPattern[touchNr].InstantTouched + PMTurnDirector.difficulty >= mainPattern[touchNr].InstantTouched && * repeatPattern[touchNr].InstantTouched - PMTurnDirector.difficulty <= mainPattern[touchNr].InstantTouched) * { * PMTextManager.PrintToPlayer("Great!"); * touchNr++; * } * else * { * PMTextManager.PrintToPlayer("Fail!"); * PMTurnDirector.GameStep = TurnDirector.GameState.F_GameOver; * } * } */ public void TouchDown(int touchNr, string colorTouched, Player player = null) { if (PMTurnDirector.GameStep == TurnDirector.GameState.E_EnterNew) { PlayerTouch lastTouch = new PlayerTouch(me, PMTimeManager.GetTimeStamp(), colorTouched); mainPattern.Add(lastTouch); PMTextManager.PrintToPlayer(stringedMainPattern(0, true)); printMainPattern("last"); PMTurnDirector.GameStep = TurnDirector.GameState.G_EndTurn; } if (PMTurnDirector.GameStep == TurnDirector.GameState.D_Repeat) { PlayerTouch rTouch = new PlayerTouch(me, PMTimeManager.GetTimeStamp(), colorTouched); repeatPattern.Add(rTouch); if (repeatPattern[touchNr].ColorTouched == mainPattern[touchNr].ColorTouched && repeatPattern[touchNr].InstantTouched + PMTurnDirector.difficulty >= mainPattern[touchNr].InstantTouched && repeatPattern[touchNr].InstantTouched - PMTurnDirector.difficulty <= mainPattern[touchNr].InstantTouched) { PMTextManager.PrintToPlayer("Great!"); print("touchNr++"); touchNr++; if (touchNr >= mainPattern.Count) { print("touchNr >= mainPattern.Count"); repeatPattern.Clear(); PMTurnDirector.GameStep = TurnDirector.GameState.E_EnterNew; return; } } else { PMTextManager.PrintToPlayer("Fail!"); PMTurnDirector.GameStep = TurnDirector.GameState.F_GameOver; } } }
private void RoomOutline(PlayerTouch _touch) { Room newRoom = Room.NONE; Ray ray = Camera.main.ScreenPointToRay(_touch.touchEnd); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, roomMask)) { Debug.Log("Raycast " + hit.transform.gameObject.name); if (hit.transform.GetComponent <RoomType>() != null) { Debug.Log("room hovered over"); newRoom = hit.transform.GetComponent <RoomType>().roomType; } else { newRoom = Room.NONE; } } Debug.Log(newRoom); if (newRoom != Room.NONE) { if (newRoom != currentRoomHoveredOver) { RoomHighlightManager.Instance.SetRoomHighlight(currentRoomHoveredOver, false); } RoomHighlightManager.Instance.SetRoomHighlight(newRoom, true); currentRoomHoveredOver = newRoom; } else { DisableAllOutlines(); } }
void Start() { dENEM = GameObject.FindGameObjectWithTag("Player"); KOD = dENEM.GetComponent <PlayerTouch>(); }