Ejemplo n.º 1
0
	// Update is called once per frame
	void Update ()
	{
		switch (CurrentState) {
		case MaidStates.Idle:
			Idle ();
			break;
		case MaidStates.Interact:
			Interact ();
			break;
		case MaidStates.Walk:
			Walk ();
			float step = speed * Time.deltaTime; 
			transform.position = Vector3.MoveTowards(transform.position, target.position, step);
			break;
		case MaidStates.Clean:
			Clean ();
			break;
		case MaidStates.Scared:
			Scared ();
			break;
		case MaidStates.Run:
			Run ();
			break;
		case MaidStates.Recover:
			Recover ();
			break;
		default:
			Debug.Log ("There is an error");
			CurrentState = MaidStates.Idle;
			break;
		}
	}
Ejemplo n.º 2
0
    void Run()
    {
        //GameObject.Find("Maid")animation.Play("Run"); //plays the running animation
        float step = (speed + 5.0f) * Time.deltaTime; //setting up the run speed

        CurrentState = MaidStates.Recover;            //run state transitions to recover state
    }
Ejemplo n.º 3
0
    void Walk()
    {
        //GameObject.Find("Maid").animation.Play("Walk"); //The code will be used to play the walk animation.
        float step = speed * Time.deltaTime;     // set the walk speed

        CurrentState = MaidStates.Clean;         //walk state transitions to the clean state
    }
Ejemplo n.º 4
0
	void Idle ()
	{
		//GameObject.Find ("Maid").animation.Play ("Idle"); //The code will be used to play the idle animation.
		if (GameObject.FindGameObjectWithTag ("Player").transform.position == GameObject.FindGameObjectWithTag("Maid").transform.position) //if the player walks towards the maid	 
			CurrentState = MaidStates.Interact; //the idle state will transit to the interact state
		else if (GameObject.FindGameObjectWithTag("Ghost").transform.position == GameObject.FindGameObjectWithTag("Maid").transform.position) //if the ghost is in the same area as the maid location
			CurrentState = MaidStates.Scared; // the idle state will transit to the scared state
		else //if none of the above transition conditions occur
			CurrentState = MaidStates.Walk; //the idle state will transit to the walk state
	}
Ejemplo n.º 5
0
 void Idle()
 {
     //GameObject.Find ("Maid").animation.Play ("Idle"); //The code will be used to play the idle animation.
     if (GameObject.FindGameObjectWithTag("Player").transform.position == GameObject.FindGameObjectWithTag("Maid").transform.position)     //if the player walks towards the maid
     {
         CurrentState = MaidStates.Interact;                                                                                               //the idle state will transit to the interact state
     }
     else if (GameObject.FindGameObjectWithTag("Ghost").transform.position == GameObject.FindGameObjectWithTag("Maid").transform.position) //if the ghost is in the same area as the maid location
     {
         CurrentState = MaidStates.Scared;                                                                                                 // the idle state will transit to the scared state
     }
     else                                                                                                                                  //if none of the above transition conditions occur
     {
         CurrentState = MaidStates.Walk;                                                                                                   //the idle state will transit to the walk state
     }
 }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        switch (CurrentState)
        {
        case MaidStates.Idle:
            Idle();
            break;

        case MaidStates.Interact:
            Interact();
            break;

        case MaidStates.Walk:
            Walk();
            float step = speed * Time.deltaTime;
            transform.position = Vector3.MoveTowards(transform.position, target.position, step);
            break;

        case MaidStates.Clean:
            Clean();
            break;

        case MaidStates.Scared:
            Scared();
            break;

        case MaidStates.Run:
            Run();
            break;

        case MaidStates.Recover:
            Recover();
            break;

        default:
            Debug.Log("There is an error");
            CurrentState = MaidStates.Idle;
            break;
        }
    }
Ejemplo n.º 7
0
	void Clean ()
	{
		//GameObject.Find("Maid")animation.Play("Clean"); //plays the clean animation.
		CurrentState = MaidStates.Idle; //clean state transitions back to idle state
	}
Ejemplo n.º 8
0
	void Walk ()
	{
		//GameObject.Find("Maid").animation.Play("Walk"); //The code will be used to play the walk animation.
		float step = speed * Time.deltaTime; // set the walk speed
		CurrentState = MaidStates.Clean; //walk state transitions to the clean state
	}
Ejemplo n.º 9
0
	void Interact ()
	{
		Debug.Log ("I will give you some tips to find the xxx item");
		CurrentState = MaidStates.Idle; //idle state transits back to idle state
	}
Ejemplo n.º 10
0
	MaidStates CurrentState; //this will store the current state

	// Use this for initialization
	void Start ()
	{
		CurrentState = MaidStates.Idle;
		rb = GetComponent<Rigidbody> ();
	}
Ejemplo n.º 11
0
 void Scared()
 {
     //GameObject.Find("Maid")animation.Play("Scared"); //plays the scared animation
     CurrentState = MaidStates.Run;         //scared state transitions into run state
 }
Ejemplo n.º 12
0
 void Interact()
 {
     Debug.Log("I will give you some tips to find the xxx item");
     CurrentState = MaidStates.Idle;         //idle state transits back to idle state
 }
Ejemplo n.º 13
0
    MaidStates CurrentState;     //this will store the current state

    // Use this for initialization
    void Start()
    {
        CurrentState = MaidStates.Idle;
        rb           = GetComponent <Rigidbody> ();
    }
Ejemplo n.º 14
0
 void Recover()
 {
     //GameObject.Find("Maid")animation.Play("Recover"); //plays the recover animation
     CurrentState = MaidStates.Idle;         //recover state transitions back to idle state
 }
Ejemplo n.º 15
0
	void Scared ()
	{
		//GameObject.Find("Maid")animation.Play("Scared"); //plays the scared animation
		CurrentState = MaidStates.Run; //scared state transitions into run state
	}
Ejemplo n.º 16
0
	void Recover ()
	{
		//GameObject.Find("Maid")animation.Play("Recover"); //plays the recover animation
		CurrentState = MaidStates.Idle; //recover state transitions back to idle state
	}
Ejemplo n.º 17
0
	void Run ()
	{
		//GameObject.Find("Maid")animation.Play("Run"); //plays the running animation
		float step = (speed + 5.0f) * Time.deltaTime; //setting up the run speed
		CurrentState = MaidStates.Recover; //run state transitions to recover state
	}
Ejemplo n.º 18
0
 void Clean()
 {
     //GameObject.Find("Maid")animation.Play("Clean"); //plays the clean animation.
     CurrentState = MaidStates.Idle;         //clean state transitions back to idle state
 }