Пример #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;
        }
Пример #2
0
        /*public ControlMechanism GetCharacterByName(string name)
         * {
         *  foreach (ControlMechanism c in ListEnemies)
         *  {
         *      if (c.gameObject.name.Equals(name))
         *      {
         *          return c;
         *      }
         *  }
         *
         *  if (Player.name.Equals(name))
         *  {
         *      return Player;
         *  }
         *
         *  return null;
         * }*/

        void FindExistingCharacters()
        {
            ControlMechanism[] controlMechanisms = GameObject.FindObjectsOfType <ControlMechanism>();
            foreach (ControlMechanism c in controlMechanisms)
            {
                if (c.controlType == ControlType.ENEMY)
                {
                    ListEnemies.Add(c);
                }
                else if (c.controlType == ControlType.PLAYER)
                {
                    Player = c;
                }
            }
        }
Пример #3
0
 public bool UpdateHit(TouchDetectorType touchDetectorType, ref ControlMechanism target)
 {
     if (IsWithinAttackTime())
     {
         TouchDetector detector  = characterData.GetTouchDetector(touchDetectorType);
         Touchable     touchable = GetFirstTouch(detector, TouchableType.CHARACTER);
         if (touchable != null)
         {
             touchable.controlMechanism.characterStateController.TakeHit(controlMechanism, characterData.characterAnimationData.DesignatedAnimation);
             target = touchable.controlMechanism;
             return(true);
         }
     }
     return(false);
 }
Пример #4
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);
                }
            }
        }
 public bool TakeHit(ControlMechanism hitter, string move)
 {
     return(characterData.hitRegister.Register(hitter.gameObject.name, move));
 }
 void Start()
 {
     controlMechanism = this.gameObject.GetComponentInParent <ControlMechanism>();
 }