// Use this for initialization void Start() { playerPosition_p = playerPosition.During; canMoving = true; playerStatus_p = playerStatus.Stand; playerMovingType_p = playerMovingType.Stop; }
void InputPlayer() { if (InputMgr.vertical >= 0.7f || InputMgr.vertical <= -0.7f) { if (InputMgr.vertical > 0.0f && canMoving == true) { canMoving = false; switch (playerPosition_p) { case playerPosition.Before: playerPosition_p = playerPosition.Before; playerMovingType_p = playerMovingType.Up; break; case playerPosition.During: playerPosition_p = playerPosition.Before; playerMovingType_p = playerMovingType.Up; break; case playerPosition.After: playerPosition_p = playerPosition.During; playerMovingType_p = playerMovingType.Up; break; } playerStatus_p = playerStatus.Moving; } else if (InputMgr.vertical < 0.0f && canMoving == true) { canMoving = false; switch (playerPosition_p) { case playerPosition.Before: playerPosition_p = playerPosition.During; playerMovingType_p = playerMovingType.Down; break; case playerPosition.During: playerPosition_p = playerPosition.After; playerMovingType_p = playerMovingType.Down; break; case playerPosition.After: playerPosition_p = playerPosition.After; playerMovingType_p = playerMovingType.Down; break; } playerStatus_p = playerStatus.Moving; } } if (InputMgr.horizontal != 0.0f) { transform.position += transform.right * InputMgr.horizontal * Time.deltaTime * speed; playerStatus_p = playerStatus.Moving; } if (InputMgr.vertical == 0.0f && InputMgr.horizontal == 0.0f) { playerStatus_p = playerStatus.Stand; } }
void OnMouseDown() { Debug.Log("Node " + u_id.ToString()); playerPosition playerPos = GameObject.FindWithTag("Player").GetComponent <playerPosition>(); if (playerPos.inDungeon) { if (StepController.totalSteps > stepCost && (playerPos.dungeonID - 1 == u_id || playerPos.dungeonID + 1 == u_id)) { StepController.totalSteps -= stepCost; playerPos.dungeonID = u_id; stepCost = 0; } } else { if (StepController.totalSteps > stepCost && (playerPos.worldID - 1 == u_id || playerPos.worldID + 1 == u_id)) { StepController.totalSteps -= stepCost; playerPos.worldID = u_id; stepCost = 0; } } }