public ErraticStrategy(IAIEntity controlled, int shootCooldown) : base(controlled, shootCooldown) { turnCooldown = 5000; cdHandler = new CooldownHandler(Util.Rand(turnCooldown)); cdHandler.StartCooldown(); }
public AIStrategy CreateByName(string strategy, IAIEntity aiEntity, IHandlesEntities entHandler) { switch (strategy.ToLower()) { case "crazyrotating": return(new CrazyRotatingStrategy(aiEntity, shootCooldown)); case "chase": return(new ChaseStrategy(aiEntity, entHandler, shootCooldown)); case "erratic": return(new ErraticStrategy(aiEntity, shootCooldown)); case "static": return(new StaticStrategy(aiEntity, shootCooldown)); case "forward": return(new ForwardStrategy(aiEntity, shootCooldown)); case "spreadforward": return(new SpreadForwardStrategy(aiEntity, shootCooldown)); default: return(new StaticStrategy(aiEntity, shootCooldown)); } }
public override void OnAwake() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); if (component is BaseMonoAvatar) { this._aiEntity = (BaseMonoAvatar)component; this.moveSpeedKey.Value = "AvatarSpeed(FIXED)"; this._speed = 0f; } else if (component is BaseMonoMonster) { this._aiEntity = (BaseMonoMonster)component; this._speed = (component as BaseMonoMonster).GetOriginMoveSpeed(this.moveSpeedKey.Value); } this._aiController = this._aiEntity.GetActiveAIController(); this._monster = this._aiEntity as BaseMonoMonster; if (this.failMoveTime <= 0f) { this._usefailMoveTime = false; } else { this._usefailMoveTime = true; this._failMoveTimer = this.failMoveTime; } }
public override void OnAwake() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); if (component is BaseMonoAvatar) { this._aiEntity = (BaseMonoAvatar)component; } else if (component is BaseMonoMonster) { this._aiEntity = (BaseMonoMonster)component; } }
public AIStrategy(IAIEntity controlled, int shootCd = 0) { this.controlled = controlled; targetDir = Util.RandomUnitVector(); commandHistory = new CommandHistory(200); CreateCommands(); if (shootCd > 0) { shootCooldown = new CooldownHandler(shootCd * 1000); } }
public override void OnAwake() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); if (component is BaseMonoAvatar) { this._aiEntity = (BaseMonoAvatar)component; } else if (component is BaseMonoMonster) { this._aiEntity = (BaseMonoMonster)component; } this._aiController = this._aiEntity.GetActiveAIController(); }
public override void OnAwake() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); if (component is BaseMonoAvatar) { this._aiEntity = (BaseMonoAvatar)component; } else if (component is BaseMonoMonster) { this._aiEntity = (BaseMonoMonster)component; } this._aiController = this._aiEntity.GetActiveAIController(); this._abilityEntity = component; this._levelAIPlugin = Singleton <LevelManager> .Instance.levelActor.GetPlugin <LevelAIPlugin>(); }
public override void OnAwake() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); if (component is BaseMonoAvatar) { this._aiEntity = (BaseMonoAvatar)component; } else if (component is BaseMonoMonster) { this._aiEntity = (BaseMonoMonster)component; } foreach (CDInfo info in this.cdList) { info.InitOnAwake(); } }
public override void OnAwake() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); if (component is BaseMonoAvatar) { this._aiEntity = (BaseMonoAvatar)component; } else if (component is BaseMonoMonster) { this._aiEntity = (BaseMonoMonster)component; } if (this.isRandom) { this.CD.Value = UnityEngine.Random.Range(this.minRandTime, this.maxRandTime); } else { this.CD.Value = this.defaultTime; } }
public override TaskStatus OnUpdate() { BaseMonoEntity component = base.GetComponent <BaseMonoMonster>(); this._aiEntity = (BaseMonoMonster)component; if (this._aiEntity.GetProperty("AI_IgnoreMaxAttackNumChance") > 0f) { return(TaskStatus.Success); } if (!Singleton <CameraManager> .Instance.GetMainCamera().IsEntityVisibleInCustomOffset(component, -5f, 5f, 0f)) { if (Singleton <CameraManager> .Instance.GetMainCamera().GetVisibleMonstersCountWithOffset(-5f, 5f, 0f) < this.avatarBeAttackMaxNum.Value) { return(this.CheckCanAttackWithMaxNum()); } if (UnityEngine.Random.value < this.resetAttackCDPos.Value) { this.AttackCD.Value = this.resetAttackCDTime.Value; return(TaskStatus.Failure); } } return(this.CheckCanAttackWithMaxNum()); }
public AIStrategy Create(IAIEntity aiEntity, IHandlesEntities entHandler) { //generate random number up to the difficulty level int n = Util.Rand(difficultyLevel); //return the hardest strategy that the number can get if (n < 5) { return(new CrazyRotatingStrategy(aiEntity, shootCooldown)); } else if (n < 10) { return(new StaticStrategy(aiEntity, shootCooldown)); } else if (n < 20) { return(new ErraticStrategy(aiEntity, shootCooldown)); } else { return(new ChaseStrategy(aiEntity, entHandler, shootCooldown)); } }
public AIStrategy Create(IAIEntity aiEntity) { return(Create(aiEntity, null)); }
public ForwardStrategy(IAIEntity controlled, int shootCd = 0) : base(controlled, shootCd) { }
public override void OnAwake() { this.monster = base.GetComponent <BaseMonoMonster>(); this._aiEntity = this.monster; this._levelAIPlugin = Singleton <LevelManager> .Instance.levelActor.GetPlugin <LevelAIPlugin>(); }
public CrazyRotatingStrategy(IAIEntity controlled, int shootCd = 0) : base(controlled, shootCd) { rotationDir = Util.Rand(-1, 2); }
/// <summary> /// Initializes a new instance of the <see cref="AIContext"/> class. /// </summary> /// <param name="entity">The entity for whom this context belongs to.</param> public AIContext(IAIEntity entity) { this.entity = entity; this.sampledPositions = new List <Vector3>(64); this.memory = new AIMemory(); }
public override void OnAwake() { this._aiEntity = (IAIEntity)base.GetComponent <BaseMonoAnimatorEntity>(); }
public StaticStrategy(IAIEntity controlled, int shootCooldown = 0) : base(controlled, shootCooldown) { targetDir = Util.RandomUnitVector(); }
public override void OnAwake() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); this._aiEntity = (BaseMonoMonster)component; }
public SpreadForwardStrategy(IAIEntity controlled, int shootCd = 0) : base(controlled, shootCd) { rotationDir = Util.Rand(-1, 3); }
public ChaseStrategy(IAIEntity controlled, IHandlesEntities entHandler, int shootCooldown = 0) : base(controlled, shootCooldown) { this.entHandler = entHandler; agroRange = SwinGame.ScreenWidth() / 1.5f; }