// ------------------------------------------------- // Start // ------------------------------------------------- void Start() { healthTimer = healthRegenTime; cntrlSchm = GetComponent <ControlScheme>(); cntrlSchm.SetControlScheme(); attackMachine = new AttackMachine(cntrlSchm, attacks); jumpKeyUp = true; dir = Direction.left; sprtRend = GetComponent <SpriteRenderer>(); rb = GetComponent <Rigidbody2D>(); foreach (Transform child in transform) { if (child.name == "GroundCheck") { groundCheck = child.gameObject; } if (child.name == "Run Sound") { runSound = child.gameObject.GetComponent <AudioSource>(); } if (child.name == "Hit Sound") { hitSound = child.gameObject.GetComponent <AudioSource>(); } } anim = GetComponent <Animator>(); }
static LibraryConfig() { AttackMachine.AddRule( (x, y) => x.Unit is IArcher || y.First().Unit is IArcher, (x, y) => (x.Attack, AttackMachineState.END), AttackMachineState.STRAIGHT_DEALING ); AttackMachine.AddRule( (x, y) => x.Unit is IPiercingShot, (x, y) => (0, AttackMachineState.STRAIGHT_DEALING), AttackMachineState.STRAIGHT_DEFENCE ); AttackMachine.AddRule( (x, y) => y.First().Unit is IPiercingShot, (x, y) => (0, AttackMachineState.RESPONSE_DEALING), AttackMachineState.RESPONSE_DEFENCE ); AttackMachine.AddRule( (x, y) => x.Unit is IHeavyWounds, (x, y) => (x.Attack, AttackMachineState.END), AttackMachineState.STRAIGHT_DEALING ); AttackMachine.AddRule( (x, y) => x.Unit is ICleave, (x, y) => (y.Count(), AttackMachineState.END), AttackMachineState.STRAIGHT_DEALING ); AttackMachine.AddRule( (x, y) => y.First().Unit is IBattleFever, (x, y) => (x.Attack, AttackMachineState.RESPONSE_ATTACK), AttackMachineState.STRAIGHT_DEALING ); AttackMachine.AddRule( (x, y) => x.Unit is IGhost, (x, y) => (new Random().Next(0, 4) == 0 ? 0 : 1, AttackMachineState.RESPONSE_ATTACK), AttackMachineState.STRAIGHT_DEALING ); }
public AttackStateWait(AttackMachine machine) : base(machine) { }
public AttackStateAfter(AttackMachine machine) : base(machine) { this._timer = new DodTimer(machine.profile.afterTime); }
public AttackStateBase(AttackMachine machine) { _machine = machine; }
public void OnTargetChoosed(IEnumerable <BattleUnitStack> targets) { _targets = targets; AttackMachine.PerformAttack(_from, targets); }
public AttackStatePrepare(AttackMachine machine) : base(machine) { _timer = new DodTimer(machine.profile.perpTime); }