private PowerUp SudoFactory(RunnerPowerUpManager picker, Type powerUpType) { if (powerUpType == typeof(PowerUp)) { return(null); } Type[] constructorParameters = { typeof(RunnerPowerUpManager) }; ConstructorInfo constructorInfo = powerUpType.GetConstructor(constructorParameters); if (constructorInfo != null) { return(constructorInfo.Invoke(new object[] { picker }) as PowerUp); } return(null); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (_ai == null) { _ai = animator.GetComponent <Ai>(); } if (_fov == null) { _fov = animator.GetComponent <FieldOfView>(); } if (_runnerPowerUpManager == null) { _runnerPowerUpManager = animator.GetComponent <RunnerPowerUpManager>(); } _runnerPowerUpManager.OnPowerUpChanged += ListenToPowerUpChange; _ai.UpdateDestination(); }
public PowerUp PickUpPower(RunnerPowerUpManager picker) { return(SudoFactory(picker, _powerUpTypes[Random.Range(0, _powerUpTypes.Length)])); }
public PowerUp(RunnerPowerUpManager powerUpManager) { _owner = powerUpManager; }
public StunBox(RunnerPowerUpManager powerUpManager) : base(powerUpManager) { }
public BowlingBall(RunnerPowerUpManager powerUpManager) : base(powerUpManager) { }
public SwiftnessPotion(RunnerPowerUpManager powerUpManager) : base(powerUpManager) { }
private void OnEnable() { Instance = this; PowerUpManager = this.GetComponent <RunnerPowerUpManager>(); }