상속: MonoBehaviour
예제 #1
0
 private void PlayerNoiseStop(TargetTracker source)
 {
     if (source.gameObject.CompareTag("playerBase"))
     {
         base.StopCoroutine("sendPlayerNoise");
     }
 }
예제 #2
0
 protected virtual void Start()
 {
     tracker      = GetComponent <TargetTracker>();
     charAnimator = GetComponentInChildren <Animator>();
     reloading    = false;
     reloadAmount = 0;
 }
 protected void OnNotDetected(TargetTracker source, Target target)
 {
     Debug.Log
     (
         string.Format("OnNotDetected triggered for tracker '{0}' by target '{1}'.", source, target)
     );
 }
예제 #4
0
 private void EnemyOutOfLight(TargetTracker source)
 {
     if (source.gameObject.name == "Light")
     {
         this.fsmFearBool.Value = false;
         this.animator.SetBoolReflected("fearBOOL", false);
     }
 }
예제 #5
0
 private void PlayerNoiseDetected(TargetTracker source)
 {
     if (source.gameObject.CompareTag("playerBase"))
     {
         base.StartCoroutine("sendPlayerNoise");
         this.setup.lastSighting.transform.position = source.transform.position;
     }
 }
예제 #6
0
 void Start()
 {
     tracker       = GetComponent <TargetTracker>();
     basicAttack   = GetComponent <BasicAttack>();
     seismicAttack = GetComponent <SeismicAreaAttack>();
     animator      = GetComponentInChildren <Animator>();
     navMeshAgent  = GetComponent <NavMeshAgent>();
 }
예제 #7
0
 private void MakeMeGreen(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     base.GetComponent <Renderer>().material.color = Color.green;
 }
예제 #8
0
 private void MakeMeGreen(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     this.renderer.material.color = Color.green;
 }
예제 #9
0
 private void MakeMeBig(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     base.transform.localScale = new Vector3(2f, 2f, 2f);
 }
예제 #10
0
 private void ResetColor(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     base.GetComponent<Renderer>().material.color = this.startingColor;
 }
예제 #11
0
 private void MakeMeNormal(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     base.transform.localScale = Vector3.one;
 }
예제 #12
0
 private void MakeMeGreen(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     base.GetComponent<Renderer>().material.color = Color.green;
 }
예제 #13
0
 private void MakeMeBig(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     base.transform.localScale = new Vector3(2f, 2f, 2f);
 }
예제 #14
0
 private void MakeMeNormal(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     base.transform.localScale = Vector3.one;
 }
예제 #15
0
    protected void OnDetected(TargetTracker source)
    {
		this.detectingTrackers.Add(source);	
				
		// Start a co-routine for each TargetTracker that detects this
		if (!this.isUpdateWhileTrackedRunning)				
			this.StartCoroutine(this.UpdateWhileTracked());
    }
예제 #16
0
 public void EnemyInLight(TargetTracker source)
 {
     if (source.gameObject.name == "Light")
     {
         this.animator.SetBoolReflected("fearBOOL", true);
         this.fsmFearBool.Value = true;
     }
 }
예제 #17
0
 private void ResetColor(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     this.renderer.material.color = this.startingColor;
 }
예제 #18
0
 private void ResetColor(TargetTracker source)
 {
     if (this.isDead)
     {
         return;
     }
     base.GetComponent <Renderer>().material.color = this.startingColor;
 }
예제 #19
0
    /// <summary>
    /// Cache
    /// </summary>
    private void Awake()
    {
        // Emitter is optional
        if (this.emitter == null)
        {
            this.emitter = this.transform;
        }

        this.targetTracker = this.GetComponent <TargetTracker>(); // Required Component
    }
        private void Awake()
        {
            this.tracker = this.GetComponent<TargetTracker>();
            this.fireCtrl = this.GetComponent<FireController>();

            this.tracker.AddOnPostSortDelegate(this.FilterTrackerTargetList);

            if (this.fireCtrl != null)
                this.fireCtrl.AddOnPreFireDelegate(this.FilterFireTargetList);
        }
예제 #21
0
        // Init by copy
        public Target(Target otherTarget)
        {
            this.gameObject = otherTarget.gameObject;
            this.transform  = otherTarget.transform;
            this.targetable = otherTarget.targetable;

            this.targetTracker  = otherTarget.targetTracker;
            this.fireController = otherTarget.fireController;
            this.projectile     = otherTarget.projectile;
        }
예제 #22
0
 void Start()
 {
     basicAttack   = GetComponent <BasicAttack>();
     seismicAttack = GetComponent <SeismicAreaAttack>();
     targetTracker = GetComponent <TargetTracker>();
     navMesh       = GetComponent <NavMeshAgent>();
     charAnimator  = GetComponentInChildren <Animator>();
     recenser      = recenserObject.GetComponent <MinionRecenser>();
     audioEmitter  = this.GetComponent <AudioSource>();
     recenser.AddMe();
 }
예제 #23
0
    private void Awake()
    {
        this.tracker  = this.GetComponent <TargetTracker>();
        this.fireCtrl = this.GetComponent <FireController>();

        this.tracker.AddOnPostSortDelegate(this.FilterTrackerTargetList);

        if (this.fireCtrl != null)
        {
            this.fireCtrl.AddOnPreFireDelegate(this.FilterFireTargetList);
        }
    }
예제 #24
0
    public new void Initialization()
    {
        base.Initialization();

        characterShooter = gameObject.GetComponent <Shooter>();
        targetTracker    = gameObject.GetComponent <TargetTracker>();

        targetTracker.onTargetFind = characterShooter.StartShooting;
        targetTracker.onTargetLost = characterShooter.StopShooting;

        //speed = 10;
        //hp = 20;
    }
예제 #25
0
        protected void FilterTrackerTargetList(TargetTracker source, TargetList targets)
        {
            // Quit if the mask is set to nothing == OFF
            if (this.targetTrackerLayerMask.value == 0)
                return;
			
			Vector3 fromPos;
			if (this.tracker.area != null)
            	fromPos = this.tracker.area.transform.position;
			else
				fromPos = this.tracker.transform.position;
			
            LayerMask mask = this.targetTrackerLayerMask;
            this.FilterTargetList(targets, mask, fromPos, Color.red);
        }
예제 #26
0
    /// <summary>
    /// Triggered when a target is first found by a perimeter
    /// </summary>
    /// <param name="source">The TargetTracker which triggered this event</param>
    internal void OnNotDetected(TargetTracker source)
    {
        #if UNITY_EDITOR
        // Higest level debug
        if (this.debugLevel > DEBUG_LEVELS.Normal)
        {
            string msg = "No longer detected by " + source.name;
            Debug.Log(string.Format("Targetable ({0}): {1}", this.name, msg));
        }
        #endif

        if (this.onNotDetectedDelegates != null)
        {
            this.onNotDetectedDelegates(source);
        }
    }
    private IEnumerator UpdateStartWhileDetected(TargetTracker source)
    {
        while (true)
        {
            if (this.isDead) yield return null;  // Just in case

            // Note: All of this could be more efficient with some caching
            if (source.targets.Contains(new Target(this.transform, source)))
            {
                this.transform.localScale = new Vector3(2, 2, 2);
                this.renderer.material.color = Color.green;
            }
            else
            {
                ResetStates();
            }

            yield return null;
        }
    }
예제 #28
0
 private IEnumerator UpdateStartWhileDetected(TargetTracker source)
 {
     for (;;)
     {
         if (this.isDead)
         {
             yield return(null);
         }
         if (source.targets.Contains(new Target(base.transform, source)))
         {
             base.transform.localScale = new Vector3(2f, 2f, 2f);
             base.GetComponent <Renderer>().material.color = Color.green;
         }
         else
         {
             this.ResetStates();
         }
         yield return(null);
     }
     yield break;
 }
예제 #29
0
    public void RemoveTarget(TargetDebug target)
    {
        TargetTracker removeTT = new TargetTracker();
        GameObject    removeGO = null;
        bool          found    = false;

        foreach (TargetTracker tt in targets)
        {
            if (tt.target == target)
            {
                found    = true;
                removeGO = tt.UIParticleSystem;
                removeTT = tt;
            }
        }
        if (removeGO)
        {
            targets.Remove(removeTT);
            StartCoroutine("DestroyObject", removeGO);
        }
    }
예제 #30
0
        public Target(Transform transform, TargetTracker targetTracker)
        {
            this.gameObject = transform.gameObject;
            this.transform  = transform;
            this.targetable = this.transform.GetComponent <Targetable>();

            this.targetTracker = targetTracker;

            // The targetTracker arg could also be a projectile because it is derrived
            //   from a TargetTracker
            if (targetTracker is Projectile)
            {
                this.projectile = (Projectile)targetTracker;
            }
            else
            {
                this.projectile = null;
            }

            this.fireController = null;
        }
    private IEnumerator UpdateStartWhileDetected(TargetTracker source)
    {
        while (true)
        {
            if (this.isDead)
            {
                yield return(null);              // Just in case
            }
            // Note: All of this could be more efficient with some caching
            if (source.targets.Contains(new Target(this.transform, source)))
            {
                this.transform.localScale    = new Vector3(2, 2, 2);
                this.renderer.material.color = Color.green;
            }
            else
            {
                ResetStates();
            }

            yield return(null);
        }
    }
예제 #32
0
파일: Player.cs 프로젝트: fnuecke/LD41
    private void HandleAttackCommand()
    {
        if (!Input.GetMouseButtonDown(1))
        {
            return;
        }

        Vector3    worldPosition = m_Camera.ScreenToWorldPoint(Input.mousePosition);
        Collider2D target        = Physics2D.OverlapPoint(worldPosition, Layers.PickingMask);

        if (target == null)
        {
            return;
        }

        Entity entity = target.GetComponentInParent <Entity>();

        if (entity == null)
        {
            return;
        }

        if (entity.GetComponent <Health>() == null)
        {
            return;
        }

        foreach (Minion minion in Minion.All)
        {
            TargetTracker targetTracker = minion.GetComponent <TargetTracker>();
            if (targetTracker == null)
            {
                continue;
            }

            targetTracker.Target = entity.gameObject;
        }
    }
		protected bool OnNewDetected(TargetTracker targetTracker, Target target)
		{
#if UNITY_EDITOR
			if (this.debugLevel > DEBUG_LEVELS.Normal)
			{
				string msg = string.Format
				(
					"Testing target '{0}' with tag '{1}' against ignore tags: '{2}'", 
					target.gameObject.name, 
					target.gameObject.tag, 
					string.Join("', '", this.ignoreList.ToArray())
				);
				Debug.Log(string.Format("IgnoreTagModifier ({0}): {1}", this.name, msg));
			}
#endif
			for (int i = 0; i < this.ignoreList.Count; i++)
			{
				this.currentTag = this.ignoreList[i];
				if (target.gameObject.tag == this.currentTag)
				{
#if UNITY_EDITOR					
					if (this.debugLevel > DEBUG_LEVELS.Off)
					{
						string msg = string.Format(
							"Ignoring target '{0}' due to tag: '{1}'", 
							target.gameObject.name, 
							this.currentTag
						);
						Debug.Log(string.Format("IgnoreTagModifier ({0}): {1}", this.name, msg));
					}
#endif
					return false;  // Stop looking and ignore
				}
			}

			return true;
		}
 private void MakeMeBig(TargetTracker source)
 {
     if (this.isDead) return;
     this.transform.localScale = new Vector3(2, 2, 2);
 }
 private void ResetColor(TargetTracker source)
 {
     if (this.isDead) return;
     this.renderer.material.color = this.startingColor;
 }
 private void OnDetected(TargetTracker source)
 {
     this.StartCoroutine(this.UpdateStartWhileDetected(source));
 }
		protected List<Target> iterTargets = new List<Target>();  // Loop cache
		
        protected void Awake()
        {
            this.fireCtrl = this.GetComponent<EventFireController>();

			// If a fireController was found it is cheaper to use its cached reference to get the 
			//	 TargetTracker
			if (this.fireCtrl != null)
				this.tracker = this.fireCtrl.targetTracker;
			else
				this.tracker = this.GetComponent<TargetTracker>();
			
			// Just in case
			if (this.fireCtrl == null && this.tracker == null)
			{
				throw new MissingComponentException
				(
					"Must have at least a TargetTracker or EventFireController"
				);			
			}
			
			// If only 1 is set, force the filterType
			if (this.fireCtrl == null || this.tracker == null)
			{
				if (this.fireCtrl != null)
					this.filterType = FILTER_TYPE.WaitToFireEvent;
				else
					this.filterType = FILTER_TYPE.IgnoreTargetTracking;
			}
			
        }
예제 #38
0
 private void OnNotDetected(TargetTracker source)
 {
     base.StopAllCoroutines();
     this.ResetStates();
 }
예제 #39
0
 internal void OnNotDetected(TargetTracker source)
 {
     if (this.onNotDetectedDelegates != null)
     {
         this.onNotDetectedDelegates(source);
     }
 }
    static void RenderPerimeterGizmo(TargetTracker tt, GizmoType gizmoType)
    {
        if (!tt.drawGizmo || !tt.enabled || tt.overrideGizmoVisibility)
        {
            return;
        }

        Color color = tt.gizmoColor;

        color.a      = 0.3f;
        Gizmos.color = color;

        // Set the space everything is drawn in.
        if (PerimeterGizmo.spaceCalculator == null)
        {
            PerimeterGizmo.spaceCalculator           = new GameObject();
            PerimeterGizmo.spaceCalculator.hideFlags = HideFlags.HideAndDontSave;
        }

        Transform xform     = PerimeterGizmo.spaceCalculator.transform;
        var       rotOffset = Quaternion.Euler(tt.perimeterRotationOffset);

        xform.rotation = tt.transform.rotation * rotOffset;
        xform.position = tt.transform.position + tt.perimeterPositionOffset;

        Gizmos.matrix = xform.localToWorldMatrix;

        //UnityEngine.Object.DestroyImmediate(xform.gameObject);


        Vector3 range            = tt.GetNormalizedRange();
        Vector3 pos              = Vector3.zero; // We set the sapce relative above
        Vector3 capsuleBottomPos = pos;
        Vector3 capsuleTopPos    = pos;

        switch (tt.perimeterShape)
        {
        case TargetTracker.PERIMETER_SHAPES.Sphere:
            Gizmos.DrawWireSphere(pos, range.x);
            break;

        case TargetTracker.PERIMETER_SHAPES.Box:
            Gizmos.DrawWireCube(pos, range);
            break;

        case TargetTracker.PERIMETER_SHAPES.Capsule:
            float delta = (range.y * 0.5f) - range.x;

            capsuleTopPos.y += Mathf.Clamp(delta, 0, delta);
            Gizmos.DrawWireSphere(capsuleTopPos, range.x);

            capsuleBottomPos.y -= Mathf.Clamp(delta, 0, delta);
            Gizmos.DrawWireSphere(capsuleBottomPos, range.x);

            // Draw 4 lines to connect the two spheres to make a capsule
            Vector3 start;
            Vector3 end;

            start    = capsuleTopPos;
            end      = capsuleBottomPos;
            start.x += range.x;
            end.x   += range.x;
            Gizmos.DrawLine(start, end);

            start    = capsuleTopPos;
            end      = capsuleBottomPos;
            start.x -= range.x;
            end.x   -= range.x;
            Gizmos.DrawLine(start, end);

            start    = capsuleTopPos;
            end      = capsuleBottomPos;
            start.z += range.x;
            end.z   += range.x;
            Gizmos.DrawLine(start, end);

            start    = capsuleTopPos;
            end      = capsuleBottomPos;
            start.z -= range.x;
            end.z   -= range.x;
            Gizmos.DrawLine(start, end);

            break;
        }

        color.a      = 0.1f;
        Gizmos.color = color;
        switch (tt.perimeterShape)
        {
        case TargetTracker.PERIMETER_SHAPES.Sphere:
            Gizmos.DrawSphere(pos, range.x);
            break;

        case TargetTracker.PERIMETER_SHAPES.Box:
            Gizmos.DrawCube(pos, range);
            break;

        case TargetTracker.PERIMETER_SHAPES.Capsule:
            Gizmos.DrawSphere(capsuleTopPos, range.x);      // Set above
            Gizmos.DrawSphere(capsuleBottomPos, range.x);   // Set above
            break;
        }

        Gizmos.matrix = Matrix4x4.zero;  // Just to be clean
    }
예제 #41
0
        /// <summary>
		/// Triggered when a target is first found by an Area
        /// </summary>
        /// <param name="source">The TargetTracker which triggered this event</param>
        internal void OnNotDetected(TargetTracker source)
        {
#if UNITY_EDITOR
            // Higest level debug
            if (this.debugLevel > DEBUG_LEVELS.Normal)
            {
                string msg = "No longer detected by " + source.name;
                Debug.Log(string.Format("Targetable ({0}): {1}", this.name, msg));
            }
#endif
			this.trackers.Remove(source);

			if (this.onNotDetectedDelegates != null) this.onNotDetectedDelegates(source);
        }
        protected void FilterTrackerTargetList(TargetTracker source, TargetList targets)
        {	
			if (this.filterType == FILTER_TYPE.IgnoreTargetTracking)
				this.FilterTargetList(targets);
			
			// Else do nothing.
		}
        /// <summary>
        /// Handles all firing events including target aquisition and firing. 
        /// Events are:
        ///     OnStart() :
        ///         Runs once when the firing system first becomes active
        ///     OnUpdate() :
        ///         Runs each frame while the firing system is active
        ///     OnTargetUpdate() : 
        ///         Runs each frame while tracking a target (there is at least one target.)
        ///     OnIdleUpdate() :
        ///         Runs each frame while the firing system is idle (no targets)
        ///     OnFire() :
        ///         Runs when it is time to fire.
        ///     
        /// Counter Behavior Notes:
        ///   * If there are no targets. the counter will keep running up. 
        ///     This means the next target to enter will be fired upon 
        ///     immediatly.
        ///     
        ///   * The counter is always active so if the last target exits, then a 
        ///     new target enters right after that, there may still be a wait.	
        /// </summary>
        protected IEnumerator FiringSystem()
        {
			
			if (this.targetTracker == null)
			{
            	this.targetTracker = this.GetComponent<TargetTracker>();
				if (this.targetTracker == null)
				{
					// Give it a frame to see if this.targetTracker is being set by code.
					yield return null;
				
					if (this.targetTracker == null)
						throw new MissingComponentException
						(
							"FireControllers must be on the same GameObject as a TargetTracker " +
							"or have it's targetTracker property set by code or drag-and-drop " + 
							"in the inspector."
						);
				}
			}

            // While (true) because of the timer, we want this to run all the time, not 
            //   start and stop based on targets in range
            if (this.initIntervalCountdownAtZero)
                this.fireIntervalCounter = 0;
            else
                this.fireIntervalCounter = this.interval;

            this.targets.Clear();
            this.OnStart();   // EVENT TRIGGER
			
			this.keepFiring = true; // Can be turned off elsewhere to kill the firing system
			
            while (this.keepFiring)
            {
                // if there is no target, counter++, handle idle behavior, and 
                //   try next frame.
                // Will init this.targets for child classes as well.
                this.targets = new TargetList(this.targetTracker.targets);

                if (this.targets.Count != 0)
                {
					if (this.fireIntervalCounter <= 0)
					{
						// Let the delegate filter a copy of the list just for the OnFire 
	                    //   Test. We still want this.targets to remain as is.
	                    //   Do this in here to still trigger OnTargetUpdate
	                    this.targetsCopy.Clear();
	                    this.targetsCopy.AddRange(this.targets);

						if (targetsCopy.Count != 0 && this.onPreFireDelegates != null)
							this.onPreFireDelegates(this.targetsCopy);
						
	                    // If all is right, fire 
						// Check targetsCopy incase of pre-fire delegate changes
	                    if (targetsCopy.Count != 0)
	                    {
	                        this.Fire();
	                        this.fireIntervalCounter = this.interval;  // Reset
	                    }
					}
					
                    // Update event while tracking a target
                    this.OnTargetUpdate(this.targets);   // EVENT TRIGGER
                }
                else
                {
                    // Update event while NOT tracking a target
                    this.OnIdleUpdate();   // EVENT TRIGGER
                }

                this.fireIntervalCounter -= Time.deltaTime;

                // Update event no matter what
                this.OnUpdate();   // EVENT TRIGGER

                // Stager calls to get Target (the whole system actually)
                yield return null;
            }
			
			// Wipe out the target list when stopped
            this.targets.Clear();
        }
예제 #44
0
		/// <summary>
		/// Triggered when the Area detects a target. If false is returned, the 
		/// target will be ignored unless detected again. Since an EventTrigger is like 
		/// an expanding shockwave, if a target is fast enough to get hit, leave and then 
		/// re-enter it makes sense to process it again.
		/// </summary>
		/// <param name='targetTracker'>
		/// The TargetTracker whose Area triggered the event. Since this EventTrigger  
		/// IS the target tracker. This is ignored. It is for event recievers that use 
		/// more than one TargetTracker.
		/// </param>
		/// <param name='target'>
		/// The target Detected
		/// </param>
		protected bool OnNewTargetHandler(TargetTracker targetTracker, Target target)
		{
			// Null detection is for direct calls rather than called-as-delegate
			if (target == Target.Null)
				return false;

#if UNITY_EDITOR
			if (this.debugLevel > DEBUG_LEVELS.Normal)
			{
				string msg = string.Format("Processing detected Target: {0}", target.transform.name);
				Debug.Log(string.Format("{0}: {1}", this, msg));
			}
#endif
			var updatedTarget = new Target(target.targetable, this);

			this.detectedTargetsCache.Add(updatedTarget);

			if (!this.blockNotifications)
				this.HandleNotifyTarget(target);

			return false;  // Force ignore
		}
예제 #45
0
    /// <summary>
    /// Cache
    /// </summary>
    private void Awake()
    {
        // Emitter is optional
        if (this.emitter == null) this.emitter = this.transform;

        this.targetTracker = this.GetComponent<TargetTracker>(); // Required Component
    }
예제 #46
0
 private void Start()
 {
     tracker = GetComponent <TargetTracker>();
 }
    static void RenderGizmo(FireDistanceModifier mod, GizmoType gizmoType)
    {
        if (!mod.drawGizmo || !mod.enabled || mod.overrideGizmoVisibility)
        {
            return;
        }

        // In the Editor, this may not be cached yet. Required component, so WILL exist
        if (mod.fireCtrl == null)
        {
            mod.fireCtrl = mod.GetComponent <EventFireController>();
        }

        TargetTracker tt = mod.fireCtrl.targetTracker;

        if (tt == null)
        {
            tt = mod.fireCtrl.GetComponent <TargetTracker>();
        }

        Transform xform = mod.transform;

        switch (mod.originMode)
        {
        case FireDistanceModifier.ORIGIN_MODE.TargetTracker:
            xform = tt.transform;
            break;

        case FireDistanceModifier.ORIGIN_MODE.TargetTrackerArea:
            var perimterTT = tt as AreaTargetTracker;
            if (perimterTT == null)
            {
                throw new System.Exception
                      (
                          "TargetTracker not a AreaTargetTracker. Use a different origin " +
                          "mode than 'TargetTrackerArea'"
                      );
            }

            // Set the space everything is drawn in.
            if (FireDistanceModifierGizmo.spaceCalculator == null)
            {
                FireDistanceModifierGizmo.spaceCalculator           = new GameObject();
                FireDistanceModifierGizmo.spaceCalculator.hideFlags = HideFlags.HideAndDontSave;
            }

            xform          = FireDistanceModifierGizmo.spaceCalculator.transform;
            xform.position =
                (
                    (perimterTT.transform.rotation * perimterTT.areaPositionOffset) +
                    perimterTT.transform.position
                );

            break;

        case FireDistanceModifier.ORIGIN_MODE.FireController:
            // Already defaulted above.
            break;

        case FireDistanceModifier.ORIGIN_MODE.FireControllerEmitter:
            if (mod.fireCtrl.spawnEventTriggerAtTransform != null)
            {
                xform = mod.fireCtrl.spawnEventTriggerAtTransform;
            }
            //else   // Already defaulted above.
            //    xform = mod.transform;
            break;
        }

        Gizmos.matrix = xform.localToWorldMatrix;

        Vector3 pos = Vector3.zero;  // We set the sapce relative above

        Color color = mod.gizmoColor;

        color.a      = 0.2f;
        Gizmos.color = color;
        Gizmos.DrawWireSphere(pos, mod.maxDistance);

        color.a      = 0.05f;
        Gizmos.color = color;
        Gizmos.DrawSphere(pos, mod.maxDistance);

        Gizmos.matrix = Matrix4x4.zero;  // Just to be clean
    }
		protected string currentTag;         // Loop Cache

        protected void Awake()
        {
            this.tracker = this.GetComponent<TargetTracker>();
        }
예제 #49
0
 protected void MakeMeGreen(TargetTracker source)
 {
     if (this.isDead) return;
     this.GetComponent<Renderer>().material.color = Color.green;
 }
예제 #50
0
 protected void MakeMeNormal(TargetTracker source)
 {
     if (this.isDead) return;
     this.transform.localScale = Vector3.one;
 }
		protected bool OnNewDetected(TargetTracker targetTracker, Target target)
		{
#if UNITY_EDITOR
			// Print the target.gameObject's name name and list of ignore targetables
			if (this.debugLevel > DEBUG_LEVELS.Normal)
			{
				string[] names = new string[this._ignoreList.Count];
				for (int i = 0; i < this._ignoreList.Count; i++)
					names[i] = this._ignoreList[i].name;
						
				string msg = string.Format
				(
					"Testing target '{0}' against ignore list: '{1}'", 
					target.gameObject.name, 
					string.Join("', '", names)
				);
				Debug.Log(string.Format("IgnoreModifier ({0}): {1}", this.name, msg));
			}
#endif

			if (this._ignoreList.Contains(target.targetable))
			{
#if UNITY_EDITOR					
				if (this.debugLevel > DEBUG_LEVELS.Off)
				{
					string msg = string.Format("Ignoring target '{0}'", target.gameObject.name);
					Debug.Log(string.Format("IgnoreModifier ({0}): {1}", this.name, msg));
				}
#endif
				return false;  // Stop looking and ignore
			}
			
			return true;
		}
        static void RenderPerimeterGizmo(TargetTracker tt, GizmoType gizmoType)
        {
            if (!tt.drawGizmo || !tt.enabled || tt.overrideGizmoVisibility) return;

            Color color = tt.gizmoColor;
            color.a = 0.3f;
            Gizmos.color = color;

            // Set the space everything is drawn in.
            if (PerimeterGizmo.spaceCalculator == null)
            {
                PerimeterGizmo.spaceCalculator = new GameObject();
                PerimeterGizmo.spaceCalculator.hideFlags = HideFlags.HideAndDontSave;
            }

            Transform xform = PerimeterGizmo.spaceCalculator.transform;

            //xform.position = tt.transform.position + tt.perimeterPositionOffset;
            xform.position = (tt.transform.rotation * tt.perimeterPositionOffset) + tt.transform.position;

            var rotOffset = Quaternion.Euler(tt.perimeterRotationOffset);
            xform.rotation = tt.transform.rotation * rotOffset;

            Gizmos.matrix = xform.localToWorldMatrix;

            //UnityEngine.Object.DestroyImmediate(xform.gameObject);


            Vector3 range = tt.GetNormalizedRange();
            Vector3 pos = Vector3.zero;  // We set the sapce relative above
            Vector3 capsuleBottomPos = pos;
            Vector3 capsuleTopPos = pos;
            switch (tt.perimeterShape)
            {
                case TargetTracker.PERIMETER_SHAPES.Sphere:
                    Gizmos.DrawWireSphere(pos, range.x);
                    break;

                case TargetTracker.PERIMETER_SHAPES.Box:
                    Gizmos.DrawWireCube(pos, range);
                    break;

                case TargetTracker.PERIMETER_SHAPES.Capsule:
                    float delta = (range.y * 0.5f) - range.x;

                    capsuleTopPos.y += Mathf.Clamp(delta, 0, delta);
                    Gizmos.DrawWireSphere(capsuleTopPos, range.x);

                    capsuleBottomPos.y -= Mathf.Clamp(delta, 0, delta);
                    Gizmos.DrawWireSphere(capsuleBottomPos, range.x);

                    // Draw 4 lines to connect the two spheres to make a capsule
                    Vector3 start;
                    Vector3 end;

                    start = capsuleTopPos;
                    end = capsuleBottomPos;
                    start.x += range.x;
                    end.x += range.x;
                    Gizmos.DrawLine(start, end);

                    start = capsuleTopPos;
                    end = capsuleBottomPos;
                    start.x -= range.x;
                    end.x -= range.x;
                    Gizmos.DrawLine(start, end);

                    start = capsuleTopPos;
                    end = capsuleBottomPos;
                    start.z += range.x;
                    end.z += range.x;
                    Gizmos.DrawLine(start, end);

                    start = capsuleTopPos;
                    end = capsuleBottomPos;
                    start.z -= range.x;
                    end.z -= range.x;
                    Gizmos.DrawLine(start, end);

                    break;
            }

            color.a = 0.1f;
            Gizmos.color = color;
            switch (tt.perimeterShape)
            {
                case TargetTracker.PERIMETER_SHAPES.Sphere:
                    Gizmos.DrawSphere(pos, range.x);
                    break;

                case TargetTracker.PERIMETER_SHAPES.Box:
                    Gizmos.DrawCube(pos, range);
                    break;

                case TargetTracker.PERIMETER_SHAPES.Capsule:
                    Gizmos.DrawSphere(capsuleTopPos, range.x);  // Set above
                    Gizmos.DrawSphere(capsuleBottomPos, range.x);  // Set above
                    break;
            }

            Gizmos.matrix = Matrix4x4.zero;  // Just to be clean
        }
예제 #53
0
 private void OnDetected(TargetTracker source)
 {
     base.StartCoroutine(this.UpdateStartWhileDetected(source));
 }
예제 #54
0
    protected void OnNotDetected(TargetTracker source)
    {
		this.detectingTrackers.Remove(source);	
	}
예제 #55
0
        protected void Awake()
        {
            this.tracker = this.GetComponent<TargetTracker>();
			this.fireCtrl = this.GetComponent<EventFireController>();
        }
 private void OnNotDetected(TargetTracker source)
 {
     this.StopAllCoroutines();
     this.ResetStates();
 }
예제 #57
0
 private void Awake()
 {
     if (this.emitter == null)
     {
         this.emitter = base.transform;
     }
     this.targetTracker = base.GetComponent<TargetTracker>();
 }
 private void MakeMeGreen(TargetTracker source)
 {
     if (this.isDead) return;
     this.renderer.material.color = Color.green;
 }
예제 #59
0
 protected void ResetColor(TargetTracker source)
 {
     if (this.isDead) return;
     this.GetComponent<Renderer>().material.color = this.startingColor;
 }
 private void initialiseStateManagers()
 {
     AudicaTargetStateManager.targetTracker = UnityEngine.Object.FindObjectOfType <TargetTracker>();
 }