Inheritance: NPCActionable
Beispiel #1
0
 public Separate(Transform owned, float maxAccel, float castRadius, string tagCompare = null)
 {
     this.owned      = owned;
     this.castRadius = castRadius;
     this.flee       = new Flee(owned, maxAccel);
     this.tagCompare = tagCompare;
 }
Beispiel #2
0
            static Modes()
            {
                ComboMenu       = Menu.AddSubMenu("Combo");
                HarassMenu      = Menu.AddSubMenu("Harass");
                LaneClearMenu   = Menu.AddSubMenu("LaneClear");
                JungleClearMenu = Menu.AddSubMenu("JungleClear");
                LastHitMenu     = Menu.AddSubMenu("LastHit");
                FleeMenu        = Menu.AddSubMenu("Flee");
                SkinMenu        = Menu.AddSubMenu("Skins");
                PermaActiveMenu = Menu.AddSubMenu("PermaActive");

                // Initialize all modes
                // Combo
                Combo.Initialize();

                // Harass
                Harass.Initialize();

                //LaneClear
                LaneClear.Initialize();

                //JungleClear
                JungleClear.Initialize();

                //LastHit
                //LastHit.Initialize();

                //Flee
                Flee.Initialize();

                //PermaActive
                PermaActive.Initialize();
            }
    public void Restart()
    {
        // Init BB

        m_Blackboard = new Blackboard();
        m_Blackboard.Trans = transform;
        m_Blackboard.Player = GameObject.FindGameObjectWithTag("Player").transform;
        m_Blackboard.Destination = transform.position + new Vector3(10, 0, 5);

        m_Bt = new BehaviorTree();
        m_Bt.m_Blackboard = m_Blackboard;

        // Init tree
        Repeat repeat = new Repeat(ref m_Bt, -1);
        Sequence randomMove = new Sequence(ref m_Bt);
        PickRandomTarget pickTarget = new PickRandomTarget();
        MoveToPoint moveBehavior = new MoveToPoint();

        randomMove.m_Children.Add(moveBehavior);
        randomMove.m_Children.Add(pickTarget);

        // Try out Chase behavior
        m_Chase = new Chase(moveBehavior, m_Bt);
        m_Flee = new Flee(moveBehavior, m_Bt);

        repeat.m_Child = randomMove;

        m_Bt.Start(repeat, this.SequenceComplete);
    }
Beispiel #4
0
 public static void FleeKeys(
     bool useQ     = true,
     bool defaultQ = true,
     bool useW     = true,
     bool defaultW = true,
     bool useE     = true,
     bool defaultE = true,
     bool useR     = true,
     bool defaultR = true)
 {
     Flee = Menu.AddSubMenu("Flee Menu", "flee");
     Flee.AddGroupLabel("Flee Settings");
     if (useQ)
     {
         Flee.AddCheckBox("flee.q", "Use Q");
     }
     if (useW)
     {
         Flee.AddCheckBox("flee.w", "Use W");
     }
     if (useE)
     {
         Flee.AddCheckBox("flee.e", "Use E");
     }
     if (useR)
     {
         Flee.AddCheckBox("flee.r", "Use R ", false);
     }
     Flee.AddSeparator();
     Flee.Add("flee.advanced", new CheckBox("Show Advanced Menu", false)).OnValueChange +=
         Value.AdvancedModeChanged;
     JsonSettings.Profile.Options.Add(new JsonSetting("flee.advanced", Setting.Checkbox, Flee["flee.advanced"].Cast <CheckBox>().CurrentValue.ToString()));
 }
Beispiel #5
0
    /// <summary>
    /// function called when the obj is created by the MooseManager in order to set all variables
    /// </summary>
    /// <param name="_cohW"></param>
    /// <param name="_sepW"></param>
    /// <param name="_aliW"></param>
    /// <param name="_sibW"></param>
    public void StartBehaviours(Bounds _movingBounds, float _padding, GameObject _predator)
    {
        cohesionInternal             = GetComponent <Cohesion>();
        cohesionInternal.weight      = coehVal.x;
        separationInternal           = GetComponent <Separation>();
        separationInternal.weight    = separVal.x;
        alignmentInternal            = GetComponent <Alignment>();
        alignmentInternal.weight     = aligVal.x;
        stayInBoundsInternal         = GetComponent <StayInBounds>();
        stayInBoundsInternal.weight  = stayInBVal.x;
        stayInBoundsInternal.bounds  = _movingBounds;
        stayInBoundsInternal.padding = _padding;
        constantSpeedInternal        = GetComponent <ConstantSpeed>();
        constantSpeedInternal.speed  = speed.x;
        fleeInternal        = GetComponent <Flee>();
        fleeInternal.evader = _predator.GetComponent <Vehicle>();



        GetComponent <Vehicle>().behaviours.Add(cohesionInternal);
        GetComponent <Vehicle>().behaviours.Add(separationInternal);
        GetComponent <Vehicle>().behaviours.Add(alignmentInternal);
        GetComponent <Vehicle>().behaviours.Add(stayInBoundsInternal);
        GetComponent <Vehicle>().behaviours.Add(constantSpeedInternal);
        GetComponent <Vehicle>().behaviours.Add(fleeInternal);

        fsm = GetComponent <FSM>();
        fsm.LoadState <FSMMooseWander>();
        fsm.LoadState <FSMMooseCauntion>();
        fsm.LoadState <FSMMooseRun>();
        fsm.ActivateState <FSMMooseWander>();
    }
Beispiel #6
0
    // Start is called before the first frame update
    void Start()
    {
        mySeek           = new Seek();
        mySeek.character = this;
        mySeek.target    = target;
        myFlee           = new Flee();
        myFlee.character = this;
        myFlee.target    = target;

        myArrv           = new Arrive();
        myArrv.character = this;
        myArrv.target    = target;

        myAlgn           = new Align();
        myAlgn.character = this;
        myAlgn.target    = target;

        myFace           = new Face();
        myFace.character = this;
        myFace.target    = target;

        myLWYG           = new LookWhereGoing();
        myLWYG.character = this;
        myLWYG.target    = target;

        myFPth           = new FollowPathDemo();
        myFPth.character = this;
        myFPth.path      = waypointList;
        //myFPth.target = target;
    }
    // Use this for initialization
    protected override void Start()
    {
        Sight    = GetComponent <FieldOfView>();
        Search   = GetComponent <AStarSearch>();
        Path     = GetComponent <ASPathFollower>();
        Wander   = GetComponent <Wander>();
        Flee     = GetComponent <Flee>();
        Face     = GetComponent <Face>();
        Agent    = GetComponent <Agent>();
        Animator = GetComponent <Animator>();

        Terrain     = GameObject.Find("Terrain");
        SearchAgent = GetComponent <ASAgent>();
        herdCentre  = GameObject.Find("HerdCentre").gameObject;

        Path.enabled = true;
        Path.path    = new ASPath();
        Path.enabled = false;

        State = new FiniteStateMachine <Ankylosaurus>(this);
        State.Change(Idle.Instance);

        collision_time = 0.0f;
        health_time    = 0.0f;
        hunger_time    = 0.0f;
        thirst_time    = 0.0f;

        base.Start();
    }
Beispiel #8
0
            public override void Enter()
            {
                pursueBehaviour = ship.boid.GetBehaviour <Pursue> ();

                if (pursueBehaviour != null)
                {
                    pursueBehaviour.enabled         = true;
                    pursueBehaviour.target          = target.boid;
                    pursueBehaviour.desiredDistance = desiredDistance;
                }

                Wander wanderBehaviour = ship.boid.GetBehaviour <Wander> ();

                if (wanderBehaviour != null)
                {
                    wanderBehaviour.enabled = true;
                    wanderBehaviour.weight  = 10f;
                }

                Flee targetFlee = target.boid.GetBehaviour <Flee> ();

                if (targetFlee != null)
                {
                    targetFlee.avoidingBoids.Add(ship.transform);
                }

                target.pursuers++;
                ship.pursuing = target;

                ship.guns[0].enabled = true;

                ship.StartCoroutine(IUpdate());
            }
Beispiel #9
0
    // Use this for initialization
    protected override void Start()
    {
        Sight   = GetComponent <FieldOfView>();
        Search  = GetComponent <AStarSearch>();
        Path    = GetComponent <ASPathFollower>();
        Wander  = GetComponent <Wander>();
        Seek    = GetComponent <Seek>();
        Flee    = GetComponent <Flee>();
        Arrive  = GetComponent <Arrive>();
        Terrain = GameObject.Find("Terrain");

        Animator    = GetComponent <Animator>();
        SearchAgent = GetComponent <ASAgent>();

        State = new FiniteStateMachine <Velociraptor>(this);
        State.Change(V_Idle.Instance);

        Path.enabled = true;
        Path.path    = new ASPath();
        Path.enabled = false;

        collision_ticks = 0.0f;
        health_time     = 0.0f;
        hunger_time     = 0.0f;
        thirst_time     = 0.0f;

        base.Start();
    }
Beispiel #10
0
 private void Start()
 {
     wander         = GetComponent <Wander>();
     flee           = GetComponent <Flee>();
     zombieAnimator = GetComponent <Animator>();
     zombieAnimator.GetBehaviours <ZombieState>().ToList().ForEach(zs => zs.zombie = this);
 }
Beispiel #11
0
    public override void Update()
    {
        if (agent.remainingDistance < 1)
        {
            if (currentIndex >= GameEnvironment.Singleton.Checkpoints.Count - 1)
            {
                currentIndex = 0;
            }
            else
            {
                currentIndex++;
            }
            agent.SetDestination(GameEnvironment.Singleton.Checkpoints[currentIndex].transform.position);
        }

        if (CanSeePlayer())
        {
            nextState = new Pursue(npc, agent, anim, player);
            stage     = EVENT.EXIT;
        }
        else if (IsPlayerBehind())
        {
            nextState = new Flee(npc, agent, anim, player);
            stage     = EVENT.ENTER;
        }
    }
Beispiel #12
0
        private void fleeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (var entity in GameWorld.Instance.Entities)
            {
                if (fleeToolStripMenuItem.Checked)
                {
                    var behaviour = new Flee();
                    if (entity.Type == EntityType.Omnivore)
                    {
                        behaviour.FleeFrom = EntityType.Herbivore;
                    }
                    else
                    {
                        behaviour.FleeFrom = EntityType.Omnivore;
                    }

                    behaviour.Radius = 150;

                    entity.AddBehaviour(behaviour);
                }
                else
                {
                    entity.RemoveBehaviour(typeof(Flee));
                }
            }
        }
Beispiel #13
0
    private void Awake()
    {
        if (gameObject.activeSelf == true)
        {
            idle   = new Idle(this);
            rest   = new Rest(this);
            eat    = new Eat(this);
            wander = new Wander(this);
            chase  = new Chase(this);
            flee   = new Flee(this);
            attack = new Attack(this);
            dead   = new Dead(this);

            navAgent = GetComponentInParent <NavMeshAgent>();

            tracker = GameObject.FindGameObjectWithTag("Tracker").GetComponent <Tracking>();

            damageOutput = gameObject.GetComponentsInChildren <Damage>();

            if (useAnimator == true)
            {
                anim = GetComponent <Animator>();
            }

            if (dynamicWandering == false)
            {
                spawnpoint = transform.position;
            }
        }
    }
Beispiel #14
0
        public static void Init(Yasuo yas)
        {
            Yas = yas;

            Config = MainMenu.AddMenu("YasuoPro", "YasuoPro");

            ComboA = Config.AddSubMenu("Combo");
            Combo.Attach(ComboA);

            HarassA = Config.AddSubMenu("Harass");
            Harass.Attach(HarassA);

            KillstealA = Config.AddSubMenu("Killsteal");
            Killsteal.Attach(KillstealA);

            FarmingA = Config.AddSubMenu("LastHitting");
            Farm.Attach(FarmingA);

            WaveclearA = Config.AddSubMenu("Waveclear");
            Waveclear.Attach(WaveclearA);

            MiscA = Config.AddSubMenu("Misc");
            Misc.Attach(MiscA);

            DrawingsA = Config.AddSubMenu("Drawings");
            Drawings.Attach(DrawingsA);

            Flee = Config.AddSubMenu("Flee Settings", "Flee");
            Flee.Add("Flee.Mode", new ComboBox("Flee Mode", 0, "To Nexus", "To Allies", "To Cursor"));
            Flee.Add("Flee.StackQ", new CheckBox("Stack Q during Flee"));
            Flee.Add("Flee.UseQ2", new CheckBox("Use Tornado", false));
        }
Beispiel #15
0
        private static void OnTick(EventArgs args)
        {
            if (Return.Activemode(Orbwalker.ActiveModes.Combo))
            {
                Combo.Execute();
            }

            if (Return.Activemode(Orbwalker.ActiveModes.Harass))
            {
                Harass.Execute();
            }

            if (Return.Activemode(Orbwalker.ActiveModes.LaneClear))
            {
                Clear.Execute();
            }

            if (Return.Activemode(Orbwalker.ActiveModes.JungleClear))
            {
                Jungle.Execute();
            }

            if (Return.Activemode(Orbwalker.ActiveModes.LastHit))
            {
                Lasthit.Execute();
            }

            if (Return.Activemode(Orbwalker.ActiveModes.Flee))
            {
                Flee.Execute();
            }


            PermaActive.Execute();
        }
        private static void OnTick(EventArgs args)
        {
            PermaActive.Execute();

            if (Activemode(Orbwalker.ActiveModes.Combo))
            {
                switch (Mode)
                {
                case 1:
                    Combo.Execute();
                    break;

                case 2:
                    Burst.Execute();
                    break;
                }
            }

            if (Activemode(Orbwalker.ActiveModes.JungleClear))
            {
                Jungle.Execute();
            }

            if (Activemode(Orbwalker.ActiveModes.LaneClear))
            {
                Lane.Execute();
            }

            if (Activemode(Orbwalker.ActiveModes.Flee))
            {
                Flee.Execute();
            }
        }
 /// <summary>
 /// Obtiene la velocidad del zombie y la aumenta para correr.
 /// </summary>
 public override void Awake()
 {
     zombie.Animate("hit");
     flee           = new Flee(zombie.GetSpeed(), zombie.GetHumano());
     timerExitState = 0;
     base.Awake();
 }
    public override SteeringOutput.SteeringOutput getSteering()
    {
        Vector2 direction = Target.getPosition() - Character.getPosition();
        float   distance  = direction.magnitude;

        float speed = Character.getVelocity().magnitude;

        float prediction;

        if (speed <= distance / maxPrediction)
        {
            prediction = maxPrediction;
        }
        else
        {
            prediction = distance / maxPrediction;
        }

        GameObject dummy      = (GameObject)MonoBehaviour.Instantiate(Resources.Load("Prefab/Dummy"));
        AgentMeta  dummyAgent = dummy.GetComponent <AgentMeta> ();

        dummyAgent.setPosition(Target.getPosition() + Target.getVelocity() * prediction);

        Behaviour flee = new Flee(dummyAgent, Character);

        SteeringOutput.SteeringOutput steering = flee.getSteering();

        MonoBehaviour.Destroy(dummy);

        Behaviour lwyg = new LWYG(Character);

        steering += lwyg.getSteering();

        return(steering);
    }
Beispiel #19
0
    // Use this for initialization
    protected override void Start()
    {
        anim          = GetComponent <Animator>();
        fov           = GetComponent <FieldOfView>();
        ankyFleeing   = GetComponent <Flee>();
        ankyWandering = GetComponent <Wander>();
        // Assert default animation booleans and floats
        anim.SetBool("isIdle", true);
        anim.SetBool("isEating", false);
        anim.SetBool("isDrinking", false);
        anim.SetBool("isAlerted", false);
        anim.SetBool("isGrazing", false);
        anim.SetBool("isAttacking", false);
        anim.SetBool("isFleeing", false);
        anim.SetBool("isDead", false);
        anim.SetFloat("speedMod", 1.0f);
        // This with GetBool and GetFloat allows
        // you to see how to change the flag parameters in the animation controller

        stateMachine = new StateMachine <MyAnky>(this);
        stateMachine.ChangeState(StateBeginning.Instance);

        gameTimer = Time.time;

        Debug.Log("Started Anky!");

        base.Start();
    }
Beispiel #20
0
        static Config()
        {
            Menu = new MenuWrapper(MENU_NAME);

            // Combo
            Combo.Initialize();

            // Harass
            Harass.Initialize();

            // WaveClear
            WaveClear.Initialize();

            // JungleClear
            JungleClear.Initialize();

            // Flee
            Flee.Initialize();

            // Keys
            Keys.Initialize();

            // Misc
            Misc.Initialize();

            // Items
            Items.Initialize();

            // Drawing
            Drawing.Initialize();
        }
Beispiel #21
0
            static Settings()
            {
                Menu0 = Config.Menu.AddSubMenu("Draw");
                Draw.Initialize();

                Menu1 = Config.Menu.AddSubMenu("Anti-Gapcloser");
                AntiGapcloser.Initialize();

                Menu2 = Config.Menu.AddSubMenu("Interrupter");
                Interrupter.Initialize();

                Menu3 = Config.Menu.AddSubMenu("Items");
                Items.Initialize();

                Menu4 = Config.Menu.AddSubMenu("Auto-Shield");
                AutoShield.Initialize();

                Menu5 = Config.Menu.AddSubMenu("Combo");
                Combo.Initialize();

                Menu6 = Config.Menu.AddSubMenu("Flee");
                Flee.Initialize();

                Menu7 = Config.Menu.AddSubMenu("Harass");
                Harass.Initialize();

                Menu8 = Config.Menu.AddSubMenu("Humanizer");
                Humanizer.Initialize();

                Menu9 = Config.Menu.AddSubMenu("Skin Hack");
                SkinHack.Initialize();
            }
Beispiel #22
0
        private static void OnTick(EventArgs args)
        {
            if (Player.Instance.IsDead)
            {
                return;
            }

            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo))
            {
                Combo.Execute();
            }

            if (Config.IsChecked(Config.AutoWMenu, "bW") && Spells.W.CanCast() &&
                Player.Instance.ManaPercent >= Config.GetSliderValue(Config.AutoWMenu, "minMana"))
            {
                AutoW.Execute();
            }

            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass) &&
                Player.Instance.ManaPercent >= Config.GetSliderValue(Config.HarassMenu, "minMana"))
            {
                Harass.Execute();
            }

            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Flee))
            {
                Flee.Execute();
            }
        }
Beispiel #23
0
    // Use this for initialization
    protected override void Start()
    {
        waterSource   = GameObject.Find("Daylight Water");
        thirst        = 100;
        health        = 100;
        energy        = 100;
        currentState  = ankyState.IDLE;
        ankyWander    = GetComponent <Wander>();
        ankyFlee      = GetComponent <Flee>();
        ankyView      = GetComponent <FieldOfView>();
        ankyFace      = GetComponent <Face>();
        ankyFaceEnemy = GetComponent <FaceEnemy>();
        ankyPursue    = GetComponent <Pursue>();
        ankySeek      = GetComponent <Seek>();
        ankyAgent     = GetComponent <Agent>();
        anim          = GetComponent <Animator>();

        // Assert default animation booleans and floats
        anim.SetBool("isIdle", true);
        anim.SetBool("isEating", false);
        anim.SetBool("isDrinking", false);
        anim.SetBool("isAlerted", false);
        anim.SetBool("isGrazing", false);
        anim.SetBool("isAttacking", false);
        anim.SetBool("isFleeing", false);
        anim.SetBool("isDead", false);
        anim.SetFloat("speedMod", 1.0f);
        // This with GetBool and GetFloat allows
        // you to see how to change the flag parameters in the animation controller

        base.Start();
    }
Beispiel #24
0
        private static void OnUpdate(EventArgs args)
        {
            if (ObjectManager.Player.IsDead)
            {
                return;
            }

            if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo)
            {
                Combo.Execute();
            }

            if (Config.IsChecked("bW") && Spells.W.CanCast() &&
                ObjectManager.Player.ManaPercent >= Config.GetSliderValue("AutoW.minMana"))
            {
                AutoW.Execute();
            }

            if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed &&
                ObjectManager.Player.ManaPercent >= Config.GetSliderValue("Harass.minMana"))
            {
                Harass.Execute();
            }

            if (Config.IsKeyPressed("assistedR"))
            {
                AssistedR.Execute();
            }

            if (Config.IsKeyPressed("fleeBind"))
            {
                Orbwalking.MoveTo(Game.CursorPos);
                Flee.Execute();
            }
        }
    public void ChangeState(UnitStates newState)
    {
        currentState = newState;

        switch (currentState)
        {
        case UnitStates.Idle:
            DestroyImmediate(fleeScript);
            DestroyImmediate(seekScript);
            break;

        case UnitStates.Flee:
            fleeScript         = gameObject.AddComponent <Flee>();
            fleeScript.target  = target;
            fleeScript.enabled = true;
            DestroyImmediate(seekScript);
            break;

        case UnitStates.Seek:
            cohesionScript.weight   = 0.7f;
            seperationScript.weight = 50.0f;

            seekScript         = gameObject.AddComponent <Seek>();
            seekScript.target  = target;
            seekScript.enabled = true;
            DestroyImmediate(fleeScript);
            break;
        }
    }
            static Settings()
            {
                Menu = Config.Menu.AddSubMenu("Settings");

                Draw.Initialize();
                Menu.AddSeparator(13);

                AntiGapcloser.Initialize();
                Menu.AddSeparator(13);

                Interrupter.Initialize();
                Menu.AddSeparator(13);

                Items.Initialize();
                Menu.AddSeparator(13);

                AutoShield.Initialize();
                Menu.AddSeparator(13);

                Combo.Initialize();
                Menu.AddSeparator(13);

                Flee.Initialize();
                Menu.AddSeparator(13);

                Harass.Initialize();
                Menu.AddSeparator(13);
            }
Beispiel #27
0
            static Modes()
            {
                // Initialize the menu
                Menu = Config.Menu.AddSubMenu("Modes");

                // Initialize all modes
                // Combo
                Combo.Initialize();
                Menu.AddSeparator();

                // Harass
                Harass.Initialize();
                Menu.AddSeparator();
                Flee.Initialize();
                Menu.AddSeparator();
                LaneClear.Initialize();
                Menu.AddSeparator();
                JungleClear.Initialize();
                Menu.AddSeparator();
                MiscMenu.Initialize();
                Menu.AddSeparator();
                Drawing.Initialize();
                Menu.AddSeparator();
                Items.Initialize();
            }
    public RunFrom()
    {
        dsevc = new DSeeEvilClone();
        henry = GameObject.FindGameObjectWithTag("Player");

        flee = henry.GetComponent <Flee>();
    }
Beispiel #29
0
 public DSeeEvilClone()
 {
     henry         = GameObject.FindGameObjectWithTag("Player");
     evilClone     = GameObject.FindGameObjectWithTag("Enemy");
     pathFollowing = henry.GetComponent <PathFollowing>();
     flee          = henry.GetComponent <Flee> ();
 }
Beispiel #30
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (ObjectManager.Player.IsDead)
            {
                return;
            }

            switch (Configs.orbwalker.ActiveMode)
            {
            case Orbwalking.OrbwalkingMode.Combo:
                Combo.ExecuteCombo();
                break;

            case Orbwalking.OrbwalkingMode.Mixed:
                LastHit.ExecuteLastHit();
                Harass.ExecuteHarass();
                break;

            case Orbwalking.OrbwalkingMode.LastHit:
                LastHit.ExecuteLastHit();
                break;

            case Orbwalking.OrbwalkingMode.LaneClear:
                LaneClear.ExecuteLaneClear();
                JungleClear.ExecuteJungleClear();
                break;

            case Orbwalking.OrbwalkingMode.CustomMode:
                Flee.ExecuteFlee();
                break;
            }

            KillSteal();
            AutoQ();
        }
Beispiel #31
0
    protected override void Start()
    {
        base.Start();

        GetAllCapturePoints();

        // Utility AI setup

        // ****** VALUES ******
        UAIV_AgentHealth              agentHealth              = new UAIV_AgentHealth(this, _AgentController._AgentStats.HealthPoints);
        UAIV_SoldierFriendlyCount     friendlySoldierCount     = new UAIV_SoldierFriendlyCount(this, 4);
        UAIV_SoldierEnemyCount        enemySoldierCount        = new UAIV_SoldierEnemyCount(this, 3);
        UAIV_DistanceToEnemy          distanceToEnemy          = new UAIV_DistanceToEnemy(this, _AgentController._Senses._ViewRange);
        UAIV_DistanceToFriendlyFlag   distanceToFriendlyFlag   = new UAIV_DistanceToFriendlyFlag(this, _AgentController._Senses._ViewRange);
        UAIV_FriendlyFlagsCount       friendlyFlagsCount       = new UAIV_FriendlyFlagsCount(this, 5);
        UAIV_AllFriendlySoldiersCount allFriendlySoldiersCount = new UAIV_AllFriendlySoldiersCount(this, _AgentController._PlayerOwner._MaxSoldiers);

        // ****** SCORERS ******
        UtilityScorer scorer_agentHealth              = new UtilityScorer(agentHealth, _HealthCurve);
        UtilityScorer scorer_friendlyCount            = new UtilityScorer(friendlySoldierCount, _FriendlyAgentsCurve);
        UtilityScorer scorer_enemyCount               = new UtilityScorer(enemySoldierCount, _EnemyAgentsCurve);
        UtilityScorer scorer_distanceToEnemy          = new UtilityScorer(distanceToEnemy, _AttackDesireCurve);
        UtilityScorer scorer_distanceToEnemyFlee      = new UtilityScorer(distanceToEnemy, _FleeDesireCurve);
        UtilityScorer scorer_distanceToFriendlyFlag   = new UtilityScorer(distanceToFriendlyFlag, _FriendlyFlagDistanceCurve);
        UtilityScorer scorer_friendlyFlagsCount       = new UtilityScorer(friendlyFlagsCount, _FriendlyFlagsForHQAttackCurve);
        UtilityScorer scorer_allFriendlySoldiersCount = new UtilityScorer(allFriendlySoldiersCount, _AllFriendlyAgentsCountCurve);

        // ****** ACTIONS ******
        CaptureFlags captureFlagsAction = new CaptureFlags(capturePointsInScene, this, 0.5f);

        AttackEnemy attackEnemyAction = new AttackEnemy(this, 0.0f);

        attackEnemyAction.AddScorer(scorer_distanceToEnemy);

        Flee fleeAction = new Flee(this, 0.0f);

        fleeAction.AddScorer(scorer_agentHealth);
        fleeAction.AddScorer(scorer_enemyCount);
        fleeAction.AddScorer(scorer_friendlyCount);
        //fleeAction.AddScorer(scorer_distanceToEnemyFlee);

        HealAtFlag healAtFlagAction = new HealAtFlag(this, 0.0f);

        healAtFlagAction.AddScorer(scorer_agentHealth);
        healAtFlagAction.AddScorer(scorer_distanceToFriendlyFlag);
        healAtFlagAction.AddScorer(scorer_distanceToEnemyFlee);

        AttackHQ attackHQAction = new AttackHQ(_AgentController._PlayerOwner._EnemyPlayer, this, 0.0f);

        attackHQAction.AddScorer(scorer_friendlyFlagsCount);
        attackHQAction.AddScorer(scorer_allFriendlySoldiersCount);

        // ****** REGISTER ACTIONS ******
        _AgentActions.Add(captureFlagsAction);
        _AgentActions.Add(attackEnemyAction);
        _AgentActions.Add(fleeAction);
        _AgentActions.Add(healAtFlagAction);
        _AgentActions.Add(attackHQAction);
    }
Beispiel #32
0
        public Separation(Entity _character, Flock _flock, float _neighbourhoodMaxDistance, float _neighbourhoodMinDotProduct)
            : base(_character, _flock, _neighbourhoodMaxDistance, _neighbourhoodMinDotProduct)
        {
            dummy = new DummyEntity();
            flee = new Flee(_character, dummy);

            maxNeighborhoodSize = 5;
        }
Beispiel #33
0
    // Use this for initialization
    public override void Start()
    {
        fleeScript = GetComponent<Flee>();
        wanderScript = GetComponent<Wander> ();
        base.Start ();
        fleeDist = rayDist;
        interDist = 3.0f * rayDist;
        isReachingGoal = false;

        actualDist = Vector3.Distance (transform.position, goal.transform.position);
        setScripts ();
    }
Beispiel #34
0
    public override IEnumerator Enter(Machine owner, Brain controller)
    {
        mainMachine = owner;
        myBrain = controller;
        Legs myLeg = myBrain.legs;

        fleeBehaviour = new Flee();

        fleeBehaviour.Init(myLeg);
        myLeg.addSteeringBehaviour(fleeBehaviour);

        //inscrease speed
        myBrain.legs.maxSpeed = 9f;
        time = 0f;

        yield return null;
    }
Beispiel #35
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public Behaviors()
 {
     Alignment = new Alignment();
     Arrive = new Arrive();
     Cohesion = new Cohesion();
     Evade = new Evade();
     Flee = new Flee();
     Hide = new Hide();
     Interpose = new Interpose();
     ObstacleAvoidance = new ObstacleAvoidance();
     OffsetPursuit = new OffsetPursuit();
     PathFollowing = new PathFollowing();
     Pursuit = new Pursuit();
     Seek = new Seek();
     Separation = new Separation();
     WallAvoidance = new WallAvoidance();
     Wander = new Wander();
 }
Beispiel #36
0
 // Use this for initialization
 void Start()
 {
     flee = GetComponent<Flee>();
 }
 // Use this for initialization
 void Start()
 {
     steeringBasics = GetComponent<SteeringBasics>();
     flee = GetComponent<Flee>();
 }