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; }
/*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; } } }
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); }
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>(); }