Exemple #1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        gV            = animator.GetComponent <globalVars>();
        looker        = gV.interactionCanvas.GetComponent <Looker>();
        roboBehaviour = animator.GetComponent <RoboBehaviour>();

        gV.feedback = true;

        animator.ResetTrigger("originReached");
        animator.ResetTrigger("statesCorrect");
        animator.ResetTrigger("targetReached");
        animator.ResetTrigger("noHelpNeeded");
        animator.ResetTrigger("finished");
        animator.ResetTrigger("feedback");
        animator.ResetTrigger("unhappy");
        animator.ResetTrigger("findObject");

        looker.StartFeedbackDialog();

        float      happyValue = 1f;
        SeeEmotion seeEmotion = roboBehaviour.GetGazedBy().GetComponentInParent <SeeEmotion>();

        if (seeEmotion != null)
        {
            seeEmotion.emotions.TryGetValue(Emotion.Happy, out happyValue);
            if (happyValue < gV.happyThreshold)
            {
                gV.asked    = false;
                gV.feedback = false;
            }
        }
        animator.SetTrigger("finished");
    }
	// Use this for initialization
	void Start () {
		
		gv = GameObject.Find ("main").GetComponent<globalVars> ();


		//Make object selected
		//gv = GameObject.Find ("main").GetComponent<globalVars> ();
		gv.selectedObject = this.gameObject;

		//Assign clip from sound bank based on dropdown selection
		mainSource = GetComponent<AudioSource> ();
		mainSource.clip = gv.getSound (gv.soundOptions.value);
		
		//Scale setup
		bc = GetComponent<BoxCollider2D> ();
		clipSize = mainSource.clip.length;
		this.transform.localScale = new Vector3 (clipSize, 1, 1);
		//bc.size = new Vector2 (clipSize, 1);

		//set parent to life side
		//parent = gameObject.transform.parent.gameObject;
		//parent.transform.position = this.transform.position;
		//parent.transform.position = new Vector3 (this.transform.position.x-(clipSize/2), this.transform.position.y, this.transform.position.z);

		//Add self to master list
		List<AudioSource> a =  (List<AudioSource>)gv.allGroups["Master"];
		a.Add (mainSource);

		//handleSnap ();

		//Set default values
		startTime = 0;
		endTime = mainSource.clip.length;

		//Setup guide line
		Debug.Log ("Scale" + this.transform.localScale.x / 2);
		//guideLine.SetPosition (0, new Vector3 (this.transform.localScale.x/2, 10, 0));
		//guideLine.SetPosition (1, new Vector3 (this.transform.localScale.x/2, -10, 0));


		//Previous group settings & master settings
		updateSoundSettings (true);
		//What happens if an effect has already been added
		//will need to check current settings
	}
    // Use this for initialization
    void Start()
    {
        //Get Player's Material for updating animation
        playerMaterial  = GetComponent <MeshRenderer>();
        globalVariables = GameObject.Find("globals").GetComponent <globalVars>();

        speed = publicFPS / publicBPS; // Frame Rate divided by number of beats in one second divided by the number of images per animation

        currentImage = 0;
        timer        = 0;
        //playingAnimation = false;

        AnimationStill[0] = Black;
        AnimationStill[1] = White;
        AnimationStill[2] = Black;
        AnimationStill[3] = White;

        AnimationDeath[0] = Black;
        AnimationDeath[1] = Red;
        AnimationDeath[2] = Black;
        AnimationDeath[3] = Red;

        AnimationJ[0] = Red;
        AnimationJ[1] = Green;
        AnimationJ[2] = Blue;
        AnimationJ[3] = Yellow;

        AnimationK[0] = Green;
        AnimationK[1] = Red;
        AnimationK[2] = Yellow;
        AnimationK[3] = Blue;

        AnimationL[0] = Blue;
        AnimationL[1] = Yellow;
        AnimationL[2] = Green;
        AnimationL[3] = Red;

        AnimationSemi[0] = Yellow;
        AnimationSemi[1] = Blue;
        AnimationSemi[2] = Red;
        AnimationSemi[3] = Green;

        AnimationDefault = AnimationStill;
    }
Exemple #4
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        roboBehaviour = animator.GetComponent <RoboBehaviour>();
        gV            = animator.GetComponent <globalVars>();

        animator.ResetTrigger("originReached");
        animator.ResetTrigger("statesCorrect");
        animator.ResetTrigger("targetReached");
        animator.ResetTrigger("noHelpNeeded");
        animator.ResetTrigger("finished");
        animator.ResetTrigger("feedback");
        animator.ResetTrigger("unhappy");
        animator.ResetTrigger("findObject");

        if (gV.asked)
        {
            gV.asked    = false;
            gV.feedback = false;
            roboBehaviour.SetGaze(null);
        }
    }
Exemple #5
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        gV     = animator.GetComponent <globalVars>();
        agent  = animator.GetComponent <NavMeshAgent>();
        looker = gV.interactionCanvas.GetComponent <Looker>();

        animator.ResetTrigger("originReached");
        animator.ResetTrigger("statesCorrect");
        animator.ResetTrigger("targetReached");
        animator.ResetTrigger("noHelpNeeded");
        animator.ResetTrigger("finished");
        animator.ResetTrigger("feedback");
        animator.ResetTrigger("unhappy");
        animator.ResetTrigger("findObject");

        gV.helpPanel.SetActive(true);
        gV.feedbackPanel.SetActive(false);
        gV.searchingObjPanel.SetActive(false);

        waitingForSecs = 0f;

        looker.StartHelpDialog();
    }
Exemple #6
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        navMeshAgent  = animator.GetComponent <NavMeshAgent>();
        roboBehaviour = animator.GetComponent <RoboBehaviour>();
        gV            = animator.GetComponent <globalVars>();

        animator.ResetTrigger("originReached");
        animator.ResetTrigger("statesCorrect");
        animator.ResetTrigger("targetReached");
        animator.ResetTrigger("noHelpNeeded");
        animator.ResetTrigger("finished");
        animator.ResetTrigger("feedback");
        animator.ResetTrigger("unhappy");
        animator.ResetTrigger("findObject");

        Vector3 follow = gV.destination;

        if (follow != null)
        {
            var     position        = follow;
            Vector3 directionVector = position - animator.transform.position;
            navMeshAgent.SetDestination(position - (directionVector.normalized * roboBehaviour.stopBefore));
        }
    }
Exemple #7
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        gV     = animator.GetComponent <globalVars>();
        looker = gV.interactionCanvas.GetComponent <Looker>();;

        animator.ResetTrigger("originReached");
        animator.ResetTrigger("statesCorrect");
        animator.ResetTrigger("targetReached");
        animator.ResetTrigger("noHelpNeeded");
        animator.ResetTrigger("finished");
        animator.ResetTrigger("feedback");
        animator.ResetTrigger("unhappy");
        animator.ResetTrigger("findObject");

        gV.interactionCanvas.gameObject.SetActive(true);

        gV.helpPanel.SetActive(false);
        gV.searchingObjPanel.SetActive(false);
        gV.feedbackPanel.SetActive(false);

        //Emotion Check fehlt noch
        if (!gV.asked)
        {
            animator.SetTrigger("unhappy");
        }
        else if (gV.asked && !gV.feedback)
        {
            looker.StartArrivalDialog();
            animator.SetTrigger("feedback");
        }
        else if (gV.asked && gV.feedback)
        {
            animator.SetTrigger("noHelpNeeded");
            gV.destination = gV.roboOrigin;
        }
    }
 // Use this for initialization
 void Start()
 {
     globalVars = GameObject.Find("globals").GetComponent <globalVars>();
     if (j)
     {
         tName  = "jAttack";
         letter = KeyCode.J;
     }
     else if (k)
     {
         tName  = "kAttack";
         letter = KeyCode.K;
     }
     else if (l)
     {
         tName  = "lAttack";
         letter = KeyCode.L;
     }
     else if (sc)
     {
         tName  = "scAttack";
         letter = KeyCode.Semicolon;
     }
 }