Exemplo n.º 1
0
        public void SlowDownToStop()
        {
            if (characterData == null || controlMechanism == null)
            {
                return;
            }

            CharacterAnimationData animationData = characterData.characterAnimationData;
            Transform characterTransform         = controlMechanism.transform;

            if (BaseSpeed > 0f)
            {
                if (FootDownTime != 0f)
                {
                    if (animationData.PlayTime <= FootDownTime)
                    {
                        BaseSpeed -= Time.deltaTime * SlowDownRate;
                    }
                    else
                    {
                        BaseSpeed -= Time.deltaTime * SlowDownRate * BreakMultiplier;
                    }
                }
                else
                {
                    BaseSpeed -= Time.deltaTime * SlowDownRate;
                }

                if (characterData.CanMoveThrough(TouchDetectorType.FRONT))
                {
                    characterTransform.Translate(Vector3.right * BaseSpeed * Time.deltaTime);
                }
            }
        }
Exemplo n.º 2
0
        public void FindDatas()
        {
            if (controlMechanism == null)
            {
                controlMechanism = this.gameObject.GetComponentInParent <ControlMechanism>();
            }

            if (characterMovementData == null)
            {
                characterMovementData = this.gameObject.GetComponentInChildren <CharacterMovementData>();
            }

            if (characterAnimationData == null)
            {
                characterAnimationData = this.gameObject.GetComponentInChildren <CharacterAnimationData>();
            }

            if (characterAttackData == null)
            {
                characterAttackData = this.gameObject.GetComponentInChildren <CharacterAttackData>();
            }

            if (hitRegister == null)
            {
                hitRegister = this.gameObject.GetComponentInChildren <HitRegister>();
            }

            TouchDetector[] detectors = controlMechanism.gameObject.GetComponentsInChildren <TouchDetector>();

            foreach (TouchDetector d in detectors)
            {
                if (!TouchDetectors.ContainsKey(d.touchDetectorType))
                {
                    TouchDetectors.Add(d.touchDetectorType, d);
                }
            }

            Touchable[] touchables = controlMechanism.gameObject.GetComponentsInChildren <Touchable>();

            foreach (Touchable t in touchables)
            {
                if (!Touchables.Contains(t))
                {
                    Touchables.Add(t);
                }
            }
        }
Exemplo n.º 3
0
        public bool IsWithinAttackTime()
        {
            CharacterAnimationData animationData = characterData.characterAnimationData;

            if (AttackStartTime != 0f && AttackEndTime != 0f)
            {
                if (animationData.PlayTime != 0f)
                {
                    if (animationData.PlayTime > AttackStartTime)
                    {
                        if (animationData.PlayTime < AttackEndTime)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }