示例#1
0
 public void InvokeOnDespawn()
 {
     if (OnDespawn != null)
     {
         OnDespawn.Invoke();
     }
 }
    void Despawn()
    {
        _player.healthComponent.enabled = false;
        _graphicsGO.SetActive(false);

        OnDespawn?.Invoke();
    }
示例#3
0
 void OnTriggerExit2D(Collider2D other)
 {
     if (other.CompareTag("SpawnArea"))
     {
         OnDespawn?.Invoke(this);
     }
 }
示例#4
0
 private void KillResource()
 {
     StopAllCoroutines();
     CollectResourceEvent?.Invoke(this, new ResourceV2Args(this));
     AddResourceEvent?.Invoke(this, new AddResourceArgs(resource_amount, resource_name));
     OnDespawn?.Invoke(this, new ResourceV2Args(this));
     Destroy(gameObject);
 }
示例#5
0
 public override void Despawn()
 {
     if (unconTimer != null && unconTimer.Started)
     {
         unconTimer.Stop();
     }
     base.Despawn();
     OnDespawn?.Invoke(this);
 }
示例#6
0
 public void Despawn()
 {
     _spawned = false;
     _manager.RemoveView(this);
     if (_updatable.Length > 0 || eventOnUpdate != null)
     {
         _server.RemoveFromUpdate(this);
     }
     OnDespawn?.Invoke();
 }
示例#7
0
    IEnumerator <float> Die()
    {
        state = State.Idle;
        HP    = 0;

        anim.CrossFadeInFixedTime(CharacterAnimationHelper.Die, 0.3f, 0, 0.6f);
        yield return(MEC.Timing.WaitForSeconds(settings.AfterDeathTime));

        OnDespawn?.Invoke();
        yield return(0f);
    }
示例#8
0
        public virtual void Despawn()
        {
            if (!this.IsSpawned)
            {
                return;
            }

            WorldInst oldWorld = this.World;

            BaseInst.Despawn();
            OnDespawn?.Invoke(this, oldWorld);
        }
示例#9
0
        /// <summary>
        /// Called every few milliseconds. This function updates the local cache of known entities.
        /// </summary>
        public void Update()
        {
            _currentManager = Game.Read <IntPtr>(Game.Read <int>(Cataclysm.CurMgrPointer) + Cataclysm.CurMgrOffset, true);
            _localGUID      = Game.Read <ulong>(_currentManager + LocalGUID, true);

            try
            {
                var newEntities = Enumerate().ToDictionary(@object => @object.OBJECT_FIELD_GUID.Value);

                foreach (var oldEntity in _entities)
                {
                    if (newEntities.ContainsKey(oldEntity.Key))
                    {
                        oldEntity.Value.UpdateBaseAddress(newEntities[oldEntity.Key].BaseAddress);

                        OnUpdate?.Invoke(oldEntity.Value);
                    }
                    else
                    {
                        OnDespawn?.Invoke(oldEntity.Value);
                    }
                }

                foreach (var newEntity in newEntities)
                {
                    if (!_entities.ContainsKey(newEntity.Key))
                    {
                        OnSpawn?.Invoke(newEntity.Value);
                    }
                }

                _entities.Clear();
                _entities = newEntities;

                OnUpdateTick?.Invoke();
            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
 private void RemoveTower()
 {
     OnDespawn?.Invoke(this, new TowerV2RefEventArgs(this));
     Destroy(this);
 }
示例#11
0
 private void Kill()
 {
     OnDespawn?.Invoke(this, new EnemyV2RefEventArgs(this));
     Destroy(gameObject);
 }
示例#12
0
 protected void CallOnDespawnEvent()
 {
     OnPoolReturnRequest.Invoke(this);
     OnDespawn?.Invoke(this);
 }
示例#13
0
 private void OnDespawnMethod()
 {
     OnDespawn?.Invoke(gameObject);
 }
示例#14
0
 private void RemoveTower()
 {
     OnDespawn?.Invoke(this, new TowerV2RefEventArgs(this));
     StopAllCoroutines();
     Destroy(gameObject);
 }
示例#15
0
 public override void Despawn()
 {
     pDespawn();
     base.Despawn();
     OnDespawn?.Invoke(this);
 }
示例#16
0
 protected void Despawn()
 {
     OnDespawn?.Invoke();
     Destroy(gameObject);
 }
示例#17
0
 public void Despawn()
 {
     OnDespawn?.Invoke();
 }
示例#18
0
        public void Update()
        {
            if (_rope != null)
            {
                _rope.Update();

                if (!_rope.Exists)
                {
                    var tmpRope = _rope;
                    _rope = null;
                    Retry();
                    OnDespawn?.Invoke(tmpRope);
                }

                return;
            }

            if (DateTime.Now > _retry)
            {
                if (_tryResolve1)
                {
                    Entity1 = API.NetToEnt(_netEntity1);

                    if (!API.DoesEntityExist(Entity1))
                    {
                        Retry();
                        return;
                    }

                    _tryResolve1 = false;
                }

                if (_tryResolve2)
                {
                    Entity2 = API.NetToEnt(_netEntity2);

                    if (!API.DoesEntityExist(Entity2))
                    {
                        Retry();
                        return;
                    }

                    _tryResolve2 = false;
                }

                if (Player != Common.PlayerID.ToString())
                {
                    GetWorldCoords(out Vector3 pos1, out Vector3 pos2);
                    var         playerCoords   = API.GetEntityCoords(API.GetPlayerPed(-1), true);
                    const float minDistSquared = NetworkRopeSpawnDistance * NetworkRopeSpawnDistance;

                    if (pos1.DistanceToSquared(playerCoords) > minDistSquared ||
                        pos2.DistanceToSquared(playerCoords) > minDistSquared)
                    {
                        Retry();
                        return;
                    }
                }

                try
                {
                    _rope           = new Rope(Player, ID, Entity1, Entity2, Offset1, Offset2, _initialLength);
                    _rope.Length    = _length;
                    _showPoolErrMsg = true;
                }
                catch (Exception)
                {
                    if (_showPoolErrMsg)
                    {
                        Debug.WriteLine("[PocceMod] no rope available in pool.. waiting");
                        _showPoolErrMsg = false;
                    }

                    Retry();
                }
            }
        }