Esempio n. 1
0
        IEnumerator Start()
        {
            yield return(new WaitForEndOfFrame());

            controlMechanism         = this.gameObject.GetComponentInParent <ControlMechanism>();
            characterStateController = this.gameObject.GetComponentInParent <CharacterStateController>();
            characterState           = this.gameObject.GetComponentInParent <CharacterState>();
            characterData            = characterStateController.characterData;
            movementData             = characterData.characterMovementData;
            vfxManager = ManagerGroup.Instance.GetManager(ManagerType.VFX_MANAGER) as VFXManager;
        }
Esempio 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);
                }
            }
        }
Esempio n. 3
0
        public MoveTransitionStates GetMoveTransition()
        {
            if (characterData == null)
            {
                return(MoveTransitionStates.NONE);
            }

            CharacterMovementData moveData = characterData.characterMovementData;

            if (moveData == null)
            {
                return(MoveTransitionStates.NONE);
            }

            if (moveData.Jump)
            {
                return(MoveTransitionStates.JUMP);
            }

            if (moveData.MoveForward)
            {
                if (moveData.Run)
                {
                    return(MoveTransitionStates.RUN);
                }
                else
                {
                    return(MoveTransitionStates.WALK);
                }
            }

            if (moveData.MoveBack)
            {
                if (moveData.Run)
                {
                    return(MoveTransitionStates.RUN);
                }
                else
                {
                    return(MoveTransitionStates.WALK);
                }
            }

            return(MoveTransitionStates.NONE);
        }
Esempio n. 4
0
        public float GetTurn()
        {
            if (controlMechanism == null)
            {
                return(0);
            }

            if (characterData == null)
            {
                return(0);
            }

            CharacterMovementData movementData       = characterData.characterMovementData;
            Transform             characterTransform = controlMechanism.transform;

            if (controlMechanism.IsFacingForward())
            {
                if (movementData.MoveBack && !movementData.MoveForward)
                {
                    return(180);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                if (!movementData.MoveBack && movementData.MoveForward)
                {
                    return(0);
                }
                else
                {
                    return(180);
                }
            }
        }