public void Init() { animator = GetComponentInChildren <Animator> (); detector = GetComponentInChildren <TriggerDetector> (); controller = GetComponent <CharacterController> (); aiProgress = GetComponent <AIProgress> (); manualInput = GetComponent <ManualInput> (); ParticleSystemTag[] particleSystemTags = GetComponentsInChildren <ParticleSystemTag> (); foreach (ParticleSystemTag p in particleSystemTags) { if (p.tag == VFXType.Trail) { particleSystemTrail = p.GetComponent <ParticleSystem> (); particleSystemTrail.Pause(true); particleSystemTrail.Clear(); } else if (p.tag == VFXType.Hold) { particleSystemHold = p.GetComponent <ParticleSystem> (); particleSystemHold.Pause(true); particleSystemHold.Clear(); } } if (manualInput != null) { isPlayerControl = true; } else { isPlayerControl = false; } // load data process xxxx SetRagdollAndAttackingParts(); //this.CharacterData.OnDead += Dead; //this.CharacterData.OnDamage += Dead; if (aiProgress != null) { aiProgress.enabled = false; } if (manualInput != null) { manualInput.enabled = false; } }
private bool IsCollidedWithAttackParts(AttackInfo info) { //List<TriggerDetector> triggers = control.GetAllTriggers (); TriggerDetector trigger = control.GetTriggerDetector(); foreach (Collider c1 in trigger.CollidingParts) { foreach (Collider c2 in info.Attacker.GetAttackingPart()) { if (c2 == c1) { return(true); } } } return(false); }