//Combine two movesets, this is here basically for the sake of the queen public moveset(moveset a, moveset b) { if (!(a.Equals(b))) { throw new Exception("The targets do not match!"); } target = a.target; //Define new lists to concatenate arrays List <game.coord> validPass = new List <game.coord>(); List <game.coord> validActi = new List <game.coord>(); //Add the contents of a to each array foreach (game.coord current in a.passiveMoves) { validPass.Add(current); } foreach (game.coord current in a.activeMoves) { validActi.Add(current); } //Add the contents of b which are not already in a to each array foreach (game.coord current in b.passiveMoves) { if (!(a.passiveMoves.Contains(current))) { validPass.Add(current); } } foreach (game.coord current in b.activeMoves) { if (!(a.activeMoves.Contains(current))) { validActi.Add(current); } } //Set the arrays activeMoves = validActi.ToArray(); passiveMoves = validPass.ToArray(); }
/// <summary> /// How do I terminate this /// </summary> /*void FootStomp() { if(currentWaitSlots.OnceOnly()) { PlantAllFeet(); } ///I think this doesnt work on like, the first tick or so ///possibly there's a big time.deltaTime? //if (currentWaitSlots.CanGoAhead(waitSlotType.attackFinished)) { currentWaitSlots.ActivateWaitSlot(waitSlotType.attackFinished); int lnum = 0; foreach(Transform child in transform) { if(child.tag == "Leg") { lnum++; if (lnum != 4) continue; ProceduralLeg leg = child.gameObject.GetComponent<ProceduralLeg>(); Vector3 randomVec = leg.getRandomFootPosition(); leg.setFootPlantTipTransition(randomVec); leg.overrideLegShiftTimeFrame(1); leg.legHub.legShiftOffsetFrac = 0.9f; leg.walkHeight = 5; } } InitiateAttack("FootStomp"); } }*/ //we need a history of attacks to complete the AI puzzle void TickAI() { ///need to use delegate //FaceAndBodyslam(); ///recoil, do this after fixing stun if(effectManager.IsStunned()) { currentWaitSlots.Reset(); currentMoveFunc = None; ///Ehh. Really we want it to flail forwards into the wall ///or obstacle, so it really gets the whole visual effect ///so below is correct technically, but practically wrong in the short term ///maybe make it do 0 damage? ///we really just need a recoil/flail //CancelAttacks(); return; } currentMoveFunc(); if (currentWaitSlots.FullyTerminated()) { currentWaitSlots.Reset(); if (DistanceToTarget(target) > GetMove("BodySlam").distance + GetSpiderBodyLength()/2 + GetSpiderHeadLength()) currentMoveFunc = Scuttle; else currentMoveFunc = FaceAndBodyslam; ///assume l and r distance are the same float sideSwipeDistance = GetMove("SideSwipeL").distance; float restLegDistance = legHub.GetLegs()[0].defaultDistLengthFromSpiderBody; //Vector3 spiderForward = new Vector3(0, 0, -1); Vector3 spiderRight = body.transform.rotation * new Vector3(-1, 0, 0); float cos_angle = Vector3.Dot(spiderRight, (target.position - body.position).normalized); float angle = Mathf.Acos(cos_angle) * Mathf.Rad2Deg; float bound_angle = 90; //float cos_45 = Mathf.Cos(45/2f); //float cos_1575 = Mathf.Cos(180 - (45 / 2f)); if(angle <= bound_angle / 2f && DistanceToTarget(target) < sideSwipeDistance + restLegDistance) { currentMoveFunc = RSwipe; } if(angle >= (180 - (bound_angle / 2f)) && DistanceToTarget(target) < sideSwipeDistance + restLegDistance) { currentMoveFunc = LSwipe; } //Debug.Log(angle + " " + (sideSwipeDistance + restLegDistance)); //currentMoveFunc = FootStomp; } }
// Use this for initialization void Start() { currentMoveFunc = None; legs = legHub.GetLegs(); }