Esempio n. 1
0
        /// moves to destination in area around target (max in search area)
        /// if target is null treat yourself as target
        /// target position is predicted in future, You can adjust the prediction via @maxRespectedTime and @timeScale
        /// @maxRespectedTime -> clamps how much in future the event will be predicted
        /// @timeScale -> specifies how important prediction is
        public void SetDestination_Search(FocusOwned focus, float searchArea, float maxRespectedTime = float.MaxValue, float timeScale = 1.0f)
        {
            if (!focus.HasTarget())
            {
                destination = (Vector2)transform.position + Random.insideUnitCircle * searchArea;
                return;
            }

            destination = focus.GetTarget().GetPosition(maxRespectedTime, timeScale) + Random.insideUnitCircle * searchArea;
        }
Esempio n. 2
0
        public void SetDestination_Flee(FocusOwned focus, RangedFloat desiredDistance, float searchArea = 1.0f)
        {
            if (!focus.HasTarget())
            {
                destination = (Vector2)transform.position + Random.insideUnitCircle.normalized * desiredDistance.GetRandom() + Random.insideUnitCircle * searchArea;
                return;
            }

            Vector2 toTarget = -focus.ToTarget();

            destination = (Vector2)transform.position + toTarget.normalized * desiredDistance.GetRandom() + Random.insideUnitCircle * searchArea;
        }
Esempio n. 3
0
 public AttentionMode(FocusOwned focus = null)
 {
     this.focus = focus;
 }