Exemple #1
0
    public virtual void SetChildAnimator(GameObject newChildObject, bool behindParent)
    {
        Transform    newChildTransform = null;
        BaseAnimator newChildAnimator  = null;

        newChildAnimator = ExtractChildAnimatorComponent(newChildObject);
        if (newChildAnimator != null)
        {
            newChildTransform = newChildObject.transform;
        }
        else
        {
            newChildObject = null;
        }
        if (behindParent)
        {
            childAnimatorBack  = newChildAnimator;
            childObjectBack    = newChildObject;
            childTransformBack = newChildTransform;
        }
        else
        {
            childAnimatorFront  = newChildAnimator;
            childObjectFront    = newChildObject;
            childTransformFront = newChildTransform;
        }
    }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="spriteAnimator"></param>
 public static void Pause(this BaseAnimator spriteAnimator)
 {
     if (spriteAnimator != null)
     {
         _baseAnimatorPlayingField.SetValue(spriteAnimator, false);
     }
 }
        private IEnumerator WaitThenCheck()
        {
            yield return(Yielders.WaitForSeconds(0.2f));

            BaseAnimator.SetBool(HasContentsState, CurrentSlot.Occupant);
            yield break;
        }
 public void SyncCurrentIndex(int value)
 {
     BaseAnimator.SetBool(HasContentsState, false);
     NetworkCurrentIndex = value;
     if (!CurrentSlot.IsInteractable && CurrentSlot.Occupant)
     {
         StartCoroutine(WaitThenCheck());
     }
 }
 public override void OnChildEnterInventory(DynamicThing newChild)
 {
     base.OnChildEnterInventory(newChild);
     if (newChild.ParentSlot == CurrentSlot && !CurrentSlot.IsInteractable)
     {
         BaseAnimator.SetBool(HasContentsState, false);
         StartCoroutine(WaitThenCheck());
     }
     CalculateFilledSlots();
 }
Exemple #6
0
        public override void Do()
        {
            base.Do();
            animator = animatedObject.GetComponent <BaseAnimator>();


            if (animator != null)
            {
                StartCoroutine(PlayAnimation());
            }
        }
Exemple #7
0
 protected virtual void ClearChildAnimators()
 {
     if (childAnimatorBack != null)
     {
         childAnimatorBack.Clear();
         childAnimatorBack = null;
     }
     if (childAnimatorFront != null)
     {
         childAnimatorFront.Clear();
         childAnimatorFront = null;
     }
 }
 public override void OnChildExitInventory(DynamicThing previousChild)
 {
     if (previousChild.ParentSlot == CurrentSlot && !CurrentSlot.IsInteractable)
     {
         BaseAnimator.SetBool(HasContentsState, false);
     }
     base.OnChildExitInventory(previousChild);
     if (!BeingDestroyed)
     {
         BaseAnimator.SetBool(HasContentsState, false);
         StartCoroutine(WaitThenCheck());
         CalculateFilledSlots();
     }
 }
Exemple #9
0
        void Start()
        {
            attack        = GetComponent <Attack>();
            animator      = GetComponent <BaseAnimator>();
            positionSpawn = (Vector2)GetComponent <Transform>().position + new Vector2(SoftRadius, -SoftRadius); //заглушка для ИИ
            bar           = GetComponent <CircularHPBar>();
            InitHUD();

            animator.UpdateCountText();
            animator.CaptureAnimation();
            StartCoroutine(FromPrototype());
            UnitPrefabs = SideUnitPrefabs();
            StartCoroutine(ProduceUnit());
        }
Exemple #10
0
    void Awake()
    {
        float temp = 0f;

        focusProvider = null;
        SetWindowDuration(particleCreationWindow);
        ResetParticleCreation();
        SetFocusOffsetRadiusRange(focusMaximumRadius, focusMinimumRadius);
        SetFocusOffsetRectangle(focusRectangleWidth, focusRectangleHeight);
        particleObjects         = null;
        particleAnimators       = null;
        particleOpaqueDurations = null;
        particleOpaqueElapsed   = null;
        particleAlphaSpeeds     = null;
        particleSpeeds          = null;
        particleSpins           = null;
        particleDepth           = DisplayDepthManager.ELEMENT_TO_ELEMENT_OFFSET / BaseAnimator.MAX_ANIMATORS_WITHIN_LAYER;
        creationsPerFocus       = (creationsPerFocus < 0) ? 0 : creationsPerFocus;
        particlesPerFocus       = 0;
        baseOpaqueAlpha         = (particleOpaqueAlpha > 1f) ? 1f : particleOpaqueAlpha;
        baseOpaqueAlpha         = (baseOpaqueAlpha < 0f) ? 0f : baseOpaqueAlpha;
        baseOpaqueDuration      = (particleOpaqueDuration > 0f) ? particleOpaqueDuration : DEFAULT_PARTICLE_OPAQUE_DURATION;
        baseAlphaSpeed          = (particleAlphaSpeed > 0f) ? particleAlphaSpeed : DEFAULT_PARTICLE_ALPHA_SPEED;
        baseMinSpeed            = particleMinSpeed;
        baseMaxSpeed            = particleMaxSpeed;
        if (baseMinSpeed.x > baseMaxSpeed.x)
        {
            temp           = baseMinSpeed.x;
            baseMinSpeed.x = baseMaxSpeed.x;
            baseMaxSpeed.x = temp;
        }
        if (baseMinSpeed.y > baseMaxSpeed.y)
        {
            temp           = baseMinSpeed.y;
            baseMinSpeed.y = baseMaxSpeed.y;
            baseMaxSpeed.y = temp;
        }
        baseMinSpin = particleMinSpin;
        baseMaxSpin = particleMaxSpin;
        if (baseMinSpin > baseMaxSpin)
        {
            temp        = baseMinSpin;
            baseMinSpin = baseMaxSpin;
            baseMinSpin = temp;
        }
    }
Exemple #11
0
 protected virtual void RecognizeBackChildAnimator()
 {
     for (int i = 0; i < gameObject.transform.childCount; i++)
     {
         childTransformBack = gameObject.transform.GetChild(i);
         if (childTransformBack != null)
         {
             childObjectBack   = childTransformBack.gameObject;
             childAnimatorBack = ExtractChildAnimatorComponent(childObjectBack);
             if (childAnimatorBack != null)
             {
                 return;
             }
             else
             {
                 childObjectBack    = null;
                 childTransformBack = null;
             }
         }
     }
 }
Exemple #12
0
    protected virtual void Awake()
    {
        particleController  = null;
        childAnimatorBack   = null;
        childAnimatorFront  = null;
        shadowObjects       = null;
        shadows             = null;
        pausedShadowObjects = null;
        pausedShadows       = null;
        Clear(false);
        if (ExtractRenderingComponent())
        {
            opaqueAlpha   = ExtractRenderingColor().a;
            currentAlpha  = opaqueAlpha;
            fadedToOpaque = true;
            FillSequencesArray();
            if ((sequenceObjects != null) && (totalSequences > 0))
            {
                firstIndexPerSequence = new int[totalSequences];
                lastIndexPerSequence  = new int[totalSequences];
                speedPerSequence      = new float[totalSequences];
                loopPerSequence       = new bool[totalSequences];
                fakeLightPerSequence  = new FakeLight[totalSequences];
                ExtractSpritesAndLights();
                Progress(0f);
            }
        }

        /*halmeida - I wil extract the associated particle controller but I will not yet set this animator
         * as that particle controller's focus provider, cause the awake on that particle controller may still
         * be called causing it to lose the reference to this script.*/
        particleController = gameObject.GetComponent <VFXParticleController>();

        /*halmeida - Every class derived from this BaseAnimator will inherit the childAnimator field as a
         * BaseAnimator instance which is severely limiting. To allow subclasses to have more complex child
         * animators, we allow the extraction and operations over the child to be customized.*/
        /*halmeida - if a certain child of the object should show in front of it or behind it is unknown.
         * To standardize, we  will assume the first animated child to be behind and ignore the rest.*/
        RecognizeBackChildAnimator();
    }
Exemple #13
0
 public void SetFocusProvider(BaseAnimator newFocusProvider)
 {
     focusProvider = newFocusProvider;
 }
Exemple #14
0
 private void BurstParticles(BaseAnimator caller)
 {
     particles.Play();
 }