public void Sync(KAnimControllerBase controller)
 {
     if (!((Object)masterController == (Object)null) && !((Object)controller == (Object)null))
     {
         KAnim.Anim currentAnim = masterController.GetCurrentAnim();
         if (currentAnim != null)
         {
             KAnim.PlayMode mode        = masterController.GetMode();
             float          playSpeed   = masterController.GetPlaySpeed();
             float          elapsedTime = masterController.GetElapsedTime();
             controller.Play(currentAnim.name, mode, playSpeed, elapsedTime);
             Facing component = controller.GetComponent <Facing>();
             if ((Object)component != (Object)null)
             {
                 Vector3 position = component.transform.GetPosition();
                 float   x        = position.x;
                 x += ((!masterController.FlipX) ? 0.5f : (-0.5f));
                 component.Face(x);
             }
             else
             {
                 controller.FlipX = masterController.FlipX;
                 controller.FlipY = masterController.FlipY;
             }
         }
     }
 }
Example #2
0
        private static void FaceCreature(Instance smi)
        {
            Facing  facing   = smi.sm.rancher.Get <Facing>(smi);
            Vector3 position = smi.ranchStation.targetRanchable.transform.GetPosition();

            facing.Face(position);
        }
Example #3
0
 public override void Update(float dt)
 {
     if ((UnityEngine.Object)gameObject != (UnityEngine.Object)null && (UnityEngine.Object)reactor != (UnityEngine.Object)null)
     {
         Facing component = reactor.GetComponent <Facing>();
         if ((UnityEngine.Object)component != (UnityEngine.Object)null)
         {
             component.Face(gameObject.transform.GetPosition());
         }
     }
     if (currentStep >= 0 && emoteSteps[currentStep].timeout > 0f && emoteSteps[currentStep].timeout < elapsed)
     {
         NextStep(null);
     }
     else
     {
         elapsed += dt;
     }
 }
Example #4
0
    private void OnStartedTalking(object data)
    {
        ConversationManager.StartedTalkingEvent startedTalkingEvent = (ConversationManager.StartedTalkingEvent)data;
        GameObject talker = startedTalkingEvent.talker;

        if ((Object)talker == (Object)base.worker.gameObject)
        {
            KBatchedAnimController component = base.worker.GetComponent <KBatchedAnimController>();
            string anim = startedTalkingEvent.anim;
            anim += Random.Range(1, 9).ToString();
            component.Play(anim, KAnim.PlayMode.Once, 1f, 0f);
            component.Queue("idle", KAnim.PlayMode.Loop, 1f, 0f);
        }
        else
        {
            Facing component2 = base.worker.GetComponent <Facing>();
            component2.Face(talker.transform.GetPosition());
            lastTalker = talker;
        }
    }