Example #1
0
        void EnableGlow()
        {
            if (glowAnim != null)
            {
                myAnim.AddAnimOverrides(glowAnim);
            }

            glowingEnabled = true;
        }
Example #2
0
        protected override void InternalBegin()
        {
            reactor_navigator = reactor.GetComponent <Navigator>();
            KBatchedAnimController component = reactor.GetComponent <KBatchedAnimController>();

            component.AddAnimOverrides(Assets.GetAnim("anim_idle_distracted_kanim"), 1f);
            component.Play("idle_pre", KAnim.PlayMode.Once, 1f, 0f);
            component.Queue("idle_default", KAnim.PlayMode.Loop, 1f, 0f);
            checkpoint.OrphanReactable();
            checkpoint.CreateNewReactable();
        }
Example #3
0
 protected override void InternalBegin()
 {
     kbac = reactor.GetComponent <KBatchedAnimController>();
     kbac.AddAnimOverrides(animset, 0f);
     if (expression != null)
     {
         reactor.GetComponent <FaceGraph>().AddExpression(expression);
     }
     if (thought != null)
     {
         reactor.GetSMI <ThoughtGraph.Instance>().AddThought(thought);
     }
     NextStep(null);
 }
Example #4
0
    private void SetAnimator()
    {
        if ((UnityEngine.Object)animController == (UnityEngine.Object)null)
        {
            animController = Util.KInstantiateUI(Assets.GetPrefab(new Tag("MinionSelectPreview")), contentBody.gameObject, false).GetComponent <KBatchedAnimController>();
            animController.gameObject.SetActive(true);
            KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>();
            animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale());
            ScreenResize instance = ScreenResize.Instance;
            instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize));
            Transform transform = animController.transform.parent.gameObject.transform.Find("BG");
            KBatchedAnimController kBatchedAnimController = (!((UnityEngine.Object)transform != (UnityEngine.Object)null)) ? null : transform.gameObject.GetComponent <KBatchedAnimController>();
            if ((UnityEngine.Object)kBatchedAnimController != (UnityEngine.Object)null)
            {
                kBatchedAnimController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale());
            }
        }
        stats.ApplyTraits(animController.gameObject);
        stats.ApplyRace(animController.gameObject);
        stats.ApplyAccessories(animController.gameObject);
        stats.ApplyExperience(animController.gameObject);
        HashedString name = idleAnims[UnityEngine.Random.Range(0, idleAnims.Length)];

        idle_anim = Assets.GetAnim(name);
        if ((UnityEngine.Object)idle_anim != (UnityEngine.Object)null)
        {
            animController.AddAnimOverrides(idle_anim, 0f);
        }
        HashedString name2 = new HashedString("crewSelect_fx_kanim");
        KAnimFile    anim  = Assets.GetAnim(name2);

        if ((UnityEngine.Object)anim != (UnityEngine.Object)null)
        {
            animController.AddAnimOverrides(anim, 0f);
        }
        animController.Queue("idle_default", KAnim.PlayMode.Loop, 1f, 0f);
    }
Example #5
0
	public void OnStore(object data)
	{
		storage = (data as Storage);
		bool flag = data is Storage || (data != null && (bool)data);
		SaveLoadRoot component = GetComponent<SaveLoadRoot>();
		if ((UnityEngine.Object)carryAnimOverride != (UnityEngine.Object)null && (UnityEngine.Object)lastCarrier != (UnityEngine.Object)null)
		{
			lastCarrier.RemoveAnimOverrides(carryAnimOverride);
			lastCarrier = null;
		}
		KSelectable component2 = GetComponent<KSelectable>();
		if ((bool)component2)
		{
			component2.IsSelectable = !flag;
		}
		if (flag)
		{
			int cachedCell = this.cachedCell;
			RefreshStorageTags(data);
			if ((object)storage != null)
			{
				if ((UnityEngine.Object)carryAnimOverride != (UnityEngine.Object)null && (UnityEngine.Object)storage.GetComponent<Navigator>() != (UnityEngine.Object)null)
				{
					lastCarrier = storage.GetComponent<KBatchedAnimController>();
					if ((UnityEngine.Object)lastCarrier != (UnityEngine.Object)null)
					{
						lastCarrier.AddAnimOverrides(carryAnimOverride, 0f);
					}
				}
				UpdateCachedCell(Grid.PosToCell(storage));
			}
			NotifyChanged(cachedCell);
			if ((UnityEngine.Object)component != (UnityEngine.Object)null)
			{
				component.SetRegistered(false);
			}
		}
		else
		{
			if ((UnityEngine.Object)component != (UnityEngine.Object)null)
			{
				component.SetRegistered(true);
			}
			RemovedFromStorage();
		}
	}
Example #6
0
 private void SetPortraitAnimator(IAssignableIdentity identity)
 {
     if (identity != null && !identity.IsNull())
     {
         if ((UnityEngine.Object)animController == (UnityEngine.Object)null)
         {
             animController = Util.KInstantiateUI(Assets.GetPrefab(new Tag("FullMinionUIPortrait")), duplicantAnimAnchor.gameObject, false).GetComponent <KBatchedAnimController>();
             animController.gameObject.SetActive(true);
             KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>();
             animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale());
             ScreenResize instance = ScreenResize.Instance;
             instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize));
         }
         string       value     = string.Empty;
         Accessorizer component = animController.GetComponent <Accessorizer>();
         for (int num = component.GetAccessories().Count - 1; num >= 0; num--)
         {
             component.RemoveAccessory(component.GetAccessories()[num].Get());
         }
         MinionIdentity       minionIdentity       = identity as MinionIdentity;
         StoredMinionIdentity storedMinionIdentity = identity as StoredMinionIdentity;
         Accessorizer         accessorizer         = null;
         if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
         {
             accessorizer = minionIdentity.GetComponent <Accessorizer>();
             foreach (ResourceRef <Accessory> accessory in accessorizer.GetAccessories())
             {
                 component.AddAccessory(accessory.Get());
             }
             value = minionIdentity.GetComponent <MinionResume>().CurrentHat;
         }
         else if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null)
         {
             foreach (ResourceRef <Accessory> accessory2 in storedMinionIdentity.accessories)
             {
                 component.AddAccessory(accessory2.Get());
             }
             value = storedMinionIdentity.currentHat;
         }
         HashedString name = "anim_idle_healthy_kanim";
         idle_anim = Assets.GetAnim(name);
         if ((UnityEngine.Object)idle_anim != (UnityEngine.Object)null)
         {
             animController.AddAnimOverrides(idle_anim, 0f);
         }
         animController.Queue("idle_default", KAnim.PlayMode.Loop, 1f, 0f);
         AccessorySlot hat = Db.Get().AccessorySlots.Hat;
         animController.SetSymbolVisiblity(hat.targetSymbolId, (!string.IsNullOrEmpty(value)) ? true : false);
         animController.SetSymbolVisiblity(Db.Get().AccessorySlots.Hair.targetSymbolId, string.IsNullOrEmpty(value) ? true : false);
         animController.SetSymbolVisiblity(Db.Get().AccessorySlots.HatHair.targetSymbolId, (!string.IsNullOrEmpty(value)) ? true : false);
         KAnim.Build.Symbol source_symbol  = null;
         KAnim.Build.Symbol source_symbol2 = null;
         if ((bool)accessorizer)
         {
             source_symbol  = accessorizer.GetAccessory(Db.Get().AccessorySlots.Hair).symbol;
             source_symbol2 = Db.Get().AccessorySlots.HatHair.Lookup("hat_" + HashCache.Get().Get(accessorizer.GetAccessory(Db.Get().AccessorySlots.Hair).symbol.hash)).symbol;
         }
         else if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null)
         {
             source_symbol  = storedMinionIdentity.GetAccessory(Db.Get().AccessorySlots.Hair).symbol;
             source_symbol2 = Db.Get().AccessorySlots.HatHair.Lookup("hat_" + HashCache.Get().Get(storedMinionIdentity.GetAccessory(Db.Get().AccessorySlots.Hair).symbol.hash)).symbol;
         }
         animController.GetComponent <SymbolOverrideController>().AddSymbolOverride(Db.Get().AccessorySlots.HairAlways.targetSymbolId, source_symbol, 1);
         animController.GetComponent <SymbolOverrideController>().AddSymbolOverride(Db.Get().AccessorySlots.HatHair.targetSymbolId, source_symbol2, 1);
     }
 }