// Update is called once per frame void Update() { if (cs.controller == Controller.Boss) { // if controlled by boss float dist = Vector3.Distance(transform.position, transform.parent.position); Vector3 dir = transform.parent.position - transform.position; dir.Normalize(); RaycastHit2D[] hits = Physics2D.RaycastAll(transform.position, dir, dist, playerMask); foreach (RaycastHit2D hit in hits) { Transform hitTrans = hit.transform; ObjectIdentity oi = hitTrans.GetComponent <ObjectIdentity> (); if (oi && oi.objType == ObjectType.AI) { LineCut lc = hitTrans.GetComponent <LineCut> (); if (lc && lc.couldCut) { // a darting AI is in between, set the status to none cs.controller = Controller.None; } } } } }
// Use this for initialization // the cut sound must be second audioSource void Start() { audioS0 = GetComponents <AudioSource>()[0]; audioS1 = GetComponents <AudioSource>()[1]; lc = GetComponent <LineCut>(); ds = GetComponent <DartSkill>(); lc.OnLineCut += Cut; }
// add for charging dart // Use this for initialization void Start() { myRigidbody = GetComponent <Rigidbody2D>(); myCapsuleColl = GetComponent <CapsuleCollider2D> (); defaultColliderWidth = myCapsuleColl.size.x; newColliderWidth = defaultColliderWidth * colliderAmpFactor; energySys = GetComponent <PlayerEnergy> (); linecut = GetComponent <LineCut> (); healthSys = GetComponent <HealthSystem>(); hd = GetComponent <HurtAndDamage> (); movement = GetComponent <PlayerMovement> (); }
// Use this for initialization void Start() { lineCut = GetComponent <LineCut> (); lineCut.OnLineCut += CreateSpark; }