示例#1
0
 private void OnTriggerExit(Collider other)
 {
     if (other.gameObject.tag == TagStatics.GetMobTag() && other.gameObject.name == TagStatics.GetPlayerName())
     {
         OnTargetExitRadius?.Invoke(other.gameObject);
         currentTarget     = null;
         _isTrackingTarget = false;
     }
 }
示例#2
0
 private void OnTriggerEnter(Collider other)
 {
     if (this.enabled)
     {
         if (other.gameObject.tag == TagStatics.GetMobTag() && other.gameObject.name == TagStatics.GetPlayerName())
         {
             AttackTarget(other.gameObject);
         }
     }
 }
示例#3
0
 private void OnDisable()
 {
     foreach (var obj in FindObjectsOfType <GameObject>())
     {
         if (obj.tag == TagStatics.GetPickupTag())
         {
             obj.GetComponent <SphereHandler>().OnPickupCollectedEvent -= UpdatePickupList;
         }
     }
 }
示例#4
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.name == TagStatics.GetPlayerName())
        {
            _pickupCollector = true;
            OnSphereDestroyed(_pickupCollector);
        }

        if (other.gameObject.name.Contains("Monster"))
        {
            _pickupCollector = false;
            OnSphereDestroyed(_pickupCollector);
        }
    }
示例#5
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == TagStatics.GetMobTag())
        {
            Destroy(gameObject);
        }
        else if (other.gameObject.tag == "Level")
        {
            Destroy(gameObject);
        }

        if (other.gameObject.tag == TagStatics.GetMobTag() && other.gameObject.name != TagStatics.GetPlayerName())
        {
            OnDamageMobEvent(other.gameObject, damageAmount);
        }
    }
示例#6
0
    private void Awake()
    {
        _pickupList     = new List <GameObject>();
        _pickupPosList  = new List <Vector3>();
        _pickupBoolList = new List <bool>();

        NumPickupsCollected = 0;
        NumPickupsLost      = 0;
        LastCollectedPos    = new Vector3(0.0f, 0.0f, 0.0f);
        LastPickupBool      = false;

        var end    = GameDataSerializer._gameDataList.Count - 1;
        var gmData = GameDataSerializer.LoadGameData(end);

        if (gmData.playerScore > 0)
        {
            PlayerScore = gmData.playerScore;
        }
        else
        {
            PlayerScore = 0;
        }

        foreach (var obj in FindObjectsOfType <GameObject>())
        {
            if (obj.tag == TagStatics.GetPickupTag())
            {
                _pickupPosList.Add(obj.transform.position);
                _pickupList.Add(obj);
                obj.GetComponent <SphereHandler>().OnPickupCollectedEvent += UpdatePickupList;
            }
        }

        NumPickupsInLevel = _pickupList.Count;

        if (_pickupList.Count <= 0)
        {
            Debug.LogWarning("PickupManager didn't find any valid pickups within the current level");
            Debug.LogWarning("Did you forget to tag any Pickup prefab instances in the scene as Pickup?");
        }


        Debug.Log("Pickup list contains " + _pickupList.Count + " pickups");
    }
示例#7
0
    private void OnTriggerEnter(Collider other)
    {
        // We detect a pickup in our radius
        if (other.gameObject.tag == TagStatics.GetPickupTag())
        {
            if (InLineOfSight(other.gameObject))
            {
                OnTargetClearLOS?.Invoke(other.gameObject);
                OnTargetInRadius?.Invoke(other.gameObject);
                _isTrackingTarget = true;
            }
            else
            {
                OnTargetInRadius?.Invoke(other.gameObject);
                _isTrackingTarget = false;
            }
        }

        if (other.gameObject.tag == TagStatics.GetMobTag() && other.gameObject.name == TagStatics.GetPlayerName())
        {
            //The mob is within our LoS
            if (InLineOfSight(other.gameObject))
            {
                OnTargetClearLOS?.Invoke(other.gameObject);
                OnTargetInRadius?.Invoke(other.gameObject);
                _isTrackingTarget = true;
            }
            else
            {
                OnTargetInRadius?.Invoke(other.gameObject);
                _isTrackingTarget = false;
                return;
            }
            currentTarget = other.gameObject;
        }


        //We heard a noise
        if (other.gameObject.tag == "Audible")
        {
            OnHeardSound?.Invoke(other.gameObject);
        }
    }