private void Beh_StateExited(object sender, StateEventBehaviour.StateEvent e)
    {
        if (e.Info.fullPathHash == stateSpinning)
        {
            cont.AddLock(this);

            positionStart = transform.position;
            timeStart = Time.time;
            //var particles =	GetComponentInChildren<ParticleSystem>();
            parts.emissionRate = 0;

        }
        if (e.Info.fullPathHash == stateStopped)
        {

            //parts.emissionRate = 100;
        }
        if(e.Info.fullPathHash == statePutaway)
        {
            parts.emissionRate = 0;
            cont.RemoveLock(this);
            nbscript.SetBool("ForceOpen", false);
            foreach (var card in LinkedCards)
            {
                card.SetActive(true);
            }
            this.gameObject.SetActive(false);
        //            DestroyObject(this.gameObject);
        }
    }
 private void Beh_StateEntered(object sender, StateEventBehaviour.StateEvent e)
 {
     if(e.Info.fullPathHash == stateGlow)
     {
         currentSprite = FoundSprite;
         OnFound();
     }
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     anim              = GetComponent <Animator>();
     beh               = anim.GetBehaviour <StateEventBehaviour>();
     hashStates        = Triggers.Select(i => Animator.StringToHash(i.State)).ToArray();
     audioSource       = GetComponent <AudioSource>();
     beh.StateEntered += Beh_StateEntered;
 }
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animator>();
     stateGlow = Animator.StringToHash("Photo.Glow");
     beh = anim.GetBehaviour<StateEventBehaviour>();
     beh.StateEntered += Beh_StateEntered;
     currentSprite = EmptySprite;
     img = GetComponent<Image>();
 }
Example #5
0
 void OnEnable()
 {
     if (anim != null)
     {
         anim.gameObject.SetActive(true);
         anim.enabled      = true;
         beh               = anim.GetBehaviour <StateEventBehaviour>();
         beh.StateEntered += Beh_StateEntered;
     }
     // hidden = false;
 }
    private void Beh_StateEntered(object sender, StateEventBehaviour.StateEvent e)
    {
        if(e.Info.fullPathHash == stateStopped)
        {
            nbscript.SetBool("ForceClosed", true);
        }
        if(e.Info.fullPathHash == statePutaway)
        {
            parts.emissionRate = 100;
            nbscript.SetBool("ForceClosed", false);
            nbscript.SetBool("ForceOpen", true);
            nbscript.CurrentPage = PageNumber;

            targetScript.ImageFound();
        }
    }
Example #7
0
    // Use this for initialization
    void Start()
    {
        cont         = FPSPlayer.GetComponent <PlayerController>();
        parts        = GetComponent <ParticleSystem>();
        targetScript = TargetImage.GetComponent <PageImageScript>();
        nbscript     = Notebook.GetComponent <NotebookScript>();

        stateSpinning = Animator.StringToHash("Card.Spinning");
        stateStopped  = Animator.StringToHash("Card.Stopped");
        statePutaway  = Animator.StringToHash("Card.Putaway");

        anim              = GetComponentInChildren <Animator>();
        beh               = anim.GetBehaviour <StateEventBehaviour>();
        beh.StateEntered += Beh_StateEntered;
        beh.StateExited  += Beh_StateExited;
//        linkedScripts = LinkedCards.Select(i => i.GetComponent<CardScript>()).ToArray();
    }
    private void Beh_StateEntered(object sender, StateEventBehaviour.StateEvent e)
    {
        var info = e.Info;
        if (info.fullPathHash == idleState)
        {
            anim.ResetTrigger("ForwardTrigger");
            anim.ResetTrigger("BackTrigger");
            anim.ResetTrigger("NotebookTrigger");
        }

        if (info.fullPathHash == closedState)
        {
            anim.ResetTrigger("ForwardTrigger");
            anim.ResetTrigger("BackTrigger");
            anim.ResetTrigger("NotebookTrigger");

            cont.RemoveLock(this);
        }
        else
        {
            cont.AddLock(this);
        }

        if (info.fullPathHash == forwardState)
        {
        }

        // start backward
        if (info.fullPathHash == backwardState)
        {
            PageBack();
        }

        // from forward to idle
        if (info.fullPathHash == idleState &&
            lastInfo.fullPathHash == forwardState)
            {
                //Finished turing page
               // PageForward();
            }
        lastInfo = info;
        SetSprites();
    }
    // Use this for initialization
    void Start()
    {
        firstMesh = FirstPage.GetComponent<MeshRenderer>();
        secondMesh = SecondPage.GetComponent<MeshRenderer>();
        cont = FPSPlayer.GetComponent<PlayerController>();

        anim = GetComponent<Animator>();
        beh = anim.GetBehaviour<StateEventBehaviour>();
        beh.StateEntered += Beh_StateEntered;
        beh.StateExited += Beh_StateExited;

        idleState = Animator.StringToHash("Notebook.Idle");
        forwardState = Animator.StringToHash("Notebook.Forward");
        backwardState = Animator.StringToHash("Notebook.Backward");
        closedState = Animator.StringToHash("Notebook.Closed");
        lastInfo = anim.GetCurrentAnimatorStateInfo(0);
        audioSource = GetComponent<AudioSource>();
    }
 private void Beh_StateExited(object sender, StateEventBehaviour.StateEvent e)
 {
     var info = e.Info;
     if(info.fullPathHash == forwardState)
     {
         PageForward();
     }
 }
Example #11
0
    // Use this for initialization
    void Start()
    {
        cont = FPSPlayer.GetComponent<PlayerController>();
        parts = GetComponent<ParticleSystem>();
        targetScript = TargetImage.GetComponent<PageImageScript>();
        nbscript = Notebook.GetComponent<NotebookScript>();

        stateSpinning = Animator.StringToHash("Card.Spinning");
        stateStopped = Animator.StringToHash("Card.Stopped");
        statePutaway = Animator.StringToHash("Card.Putaway");

        anim = GetComponentInChildren<Animator>();
        beh = anim.GetBehaviour<StateEventBehaviour>();
        beh.StateEntered += Beh_StateEntered;
        beh.StateExited += Beh_StateExited;
        //        linkedScripts = LinkedCards.Select(i => i.GetComponent<CardScript>()).ToArray();
    }
Example #12
0
 /*
 void SetHidden(bool val)
 {
     this.gameObject.SetActive(!val);
 }
 */
 void OnEnable()
 {
     if(anim!= null)
     {
         anim.gameObject.SetActive(true);
         anim.enabled = true;
         beh = anim.GetBehaviour<StateEventBehaviour>();
         beh.StateEntered += Beh_StateEntered;
         beh.StateExited += Beh_StateExited;
     }
        // hidden = false;
 }