private void Awake()
    {
        manualInput       = GetComponent <ManualInput>();
        animationProgress = GetComponent <AnimationProgress>();
        aiProgress        = GetComponentInChildren <AIProgress>();
        damageDetector    = GetComponentInChildren <DamageDetector>();
        boxCollider       = GetComponent <BoxCollider>();
        animator          = GetComponentInChildren <Animator>();
        obstacle          = GetComponent <NavMeshObstacle>();

        collisionSpheres       = GetComponentInChildren <CollisionSpheres>();
        collisionSpheres.owner = this;
        CollisionSpheres.SetupColliders(boxCollider, out float bottom, out float top, out float front, out float back, out float right, out float left);
        collisionSpheres.PlaceEdgeSphere(bottom, top, front, back, left, right);
        collisionSpheres.FindEveryChild(gameObject.transform);

        aiController = GetComponentInChildren <AIController>();
        if (aiController == null)
        {
            if (obstacle != null)
            {
                obstacle.carving = true;
            }
        }

        RegisterCharacter();
    }
Exemplo n.º 2
0
 protected void InitializeController()
 {
     characterState     = GetComponent <CharacterState>();
     characterInventory = GetComponent <CharacterInventory>();
     animationProgress  = new AnimationProgress();
     characterAnimator  = GetComponentInChildren <Animator>();
     characterRigidbody = GetComponent <Rigidbody>();
 }
    private void Awake()
    {
        bool SwitchBack = false;

        if (!IsFacingForward())
        {
            SwitchBack = true;
        }

        FaceForward(true);

        SetColliderSpheres();

        if (SwitchBack)
        {
            FaceForward(false);
        }

        animationProgress = GetComponent <AnimationProgress>();
        damageDetector    = GetComponentInChildren <DamageDetector>();
    }
Exemplo n.º 4
0
        private void AnimationTimerOnTick(object sender, EventArgs eventArgs)
        {
            for (int i = 0; i < this._animationProgresses.Count; i++)
            {
                this.UpdateProgress(i);
                int num;
                if (!this.Singular)
                {
                    if (this._animationDirections[i] == AnimationDirection.InOutIn && this._animationProgresses[i] == 1.0)
                    {
                        this._animationDirections[i] = AnimationDirection.InOutOut;
                        continue;
                    }
                    if (this._animationDirections[i] == AnimationDirection.InOutRepeatingIn && this._animationProgresses[i] == 0.0)
                    {
                        this._animationDirections[i] = AnimationDirection.InOutRepeatingOut;
                        continue;
                    }
                    if (this._animationDirections[i] == AnimationDirection.InOutRepeatingOut && this._animationProgresses[i] == 0.0)
                    {
                        this._animationDirections[i] = AnimationDirection.InOutRepeatingIn;
                        continue;
                    }
                    if (this._animationDirections[i] == AnimationDirection.In && this._animationProgresses[i] == 1.0)
                    {
                        goto IL_0160;
                    }
                    if (this._animationDirections[i] == AnimationDirection.Out && this._animationProgresses[i] == 0.0)
                    {
                        goto IL_0160;
                    }
                    num = ((this._animationDirections[i] == AnimationDirection.InOutOut && this._animationProgresses[i] == 0.0) ? 1 : 0);
                    goto IL_0161;
                }
                if (this._animationDirections[i] == AnimationDirection.InOutIn && this._animationProgresses[i] == 1.0)
                {
                    this._animationDirections[i] = AnimationDirection.InOutOut;
                }
                else if (this._animationDirections[i] == AnimationDirection.InOutRepeatingIn && this._animationProgresses[i] == 1.0)
                {
                    this._animationDirections[i] = AnimationDirection.InOutRepeatingOut;
                }
                else if (this._animationDirections[i] == AnimationDirection.InOutRepeatingOut && this._animationProgresses[i] == 0.0)
                {
                    this._animationDirections[i] = AnimationDirection.InOutRepeatingIn;
                }
                continue;
IL_0161:
                if (num != 0)
                {
                    this._animationProgresses.RemoveAt(i);
                    this._animationSources.RemoveAt(i);
                    this._animationDirections.RemoveAt(i);
                    this._animationDatas.RemoveAt(i);
                }
                continue;
IL_0160:
                num = 1;
                goto IL_0161;
            }
            AnimationProgress onAnimationProgress = this.OnAnimationProgress;

            if (onAnimationProgress != null)
            {
                onAnimationProgress(this);
            }
        }