Example #1
0
 private void OnClickEvent(EventManager EM, ClickPositionArgs e)
 {
     Ray ray = Camera.main.ScreenPointToRay (e.position);
     RaycastHit hit;
     if(this.collider.Raycast(ray, out hit, 10)) {
         DoClick(e);
     }
 }
    private void OnHoldClick(EventManager EM, ClickPositionArgs e)
    {
        if (isGamePaused()) return;
        if (currentState.GetType() == typeof(TalkState)){
            GUIManager.Instance.CloseInteractionMenu();
        }

        pos = Camera.main.ScreenToWorldPoint(e.position);

        if (HoldIsTooClose(pos)) {
            timeSinceLastHold = 1;
            return;
        }
        if (timeSinceLastHold > TIMEBETWEENHOLDMOVES){
            pos.z = this.transform.position.z;

            if (!(currentState is MoveState)){
                EnterState(new MoveState(this, pos)); // move normaly
            } else {
                ((MoveState) currentState).UpdateGoal(pos);
            }

            timeSinceLastHold = 0;
        } else {
            timeSinceLastHold += Time.deltaTime;
        }
    }
    // We want to be able to switch to move at any state when the player clicks
    private void OnClickToMove(EventManager EM, ClickPositionArgs e)
    {
        if (isGamePaused()) return;
        if (currentState.GetType() == typeof(TalkState)){
            GUIManager.Instance.CloseInteractionMenu();
        }
        pos = Camera.main.ScreenToWorldPoint(e.position);
        pos.z = this.transform.position.z;

        if (currentState.GetType() == typeof(IdleState) || currentState.GetType().IsSubclassOf(typeof(MoveState))){
            EnterState(new MoveState(this, pos, 5f)); // If we are idling of in a movethen do state cancel and move to the new position
        } else if (currentState.GetType() == typeof(MoveState)){
            ((MoveState) currentState).UpdateGoal(pos);
        }
        touchParticleEmitter.transform.localPosition = pos;
        touchParticleEmitter.Play();
    }
Example #4
0
 protected override void DoClick(ClickPositionArgs e)
 {
 }
Example #5
0
 private void OnHoldClick(EventManager EM, ClickPositionArgs e)
 {
     Time.timeScale = MAXSPEEDMULTIPLIER;
 }
Example #6
0
 protected override void DoClick(ClickPositionArgs e)
 {
     EventManager.instance.RiseOnClickOnPlayerEvent();
 }
Example #7
0
 protected abstract void DoClick(ClickPositionArgs e);