public override void Shoot(Vector2 touchPoint, State state)
    {
        _circleTrigger = Instantiate(_circleTriggerPrefab, new Vector3(touchPoint.x, touchPoint.y, state.transform.position.z), Quaternion.identity);

        _circleTrigger.CircleCollider.radius = _radius;
        _circleTrigger.SituationTriggerStay += OnSituationTriggerStay;

        var _tornadoEffect = Instantiate(_tornadoEffectPrefab, _circleTrigger.transform.position, Quaternion.identity, _circleTrigger.transform);

        Destroy(_circleTrigger.gameObject, _lifeTime);
    }
Beispiel #2
0
        public void Load(ContentManager content, Entity owner)
        {
            ColliderCategory colliderCategory = ColliderCategory.Trigger;
            ColliderCategory collidesWith     = ColliderCategory.Actor;

            m_spotTrigger  = new CircleTrigger(owner, "SpotTrigger", m_spotRadius, colliderCategory, collidesWith);
            m_sightTrigger = new CircleTrigger(owner, "SightTrigger", m_sightRadius, colliderCategory, collidesWith);

            m_spotTrigger.Revive();            //need to move to revie function of some kind so triggers are removed when object is out of area? maybe not if pools exist?
            m_sightTrigger.Revive();

            m_spotTrigger.AddCollisionHandler(Spot_OnCollision);
            m_sightTrigger.AddSeparationHandler(Sight_OnSeparation);
        }
Beispiel #3
0
 static int InTriggerNow(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         CircleTrigger obj = (CircleTrigger)ToLua.CheckObject(L, 1, typeof(CircleTrigger));
         bool          o   = obj.InTriggerNow();
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #4
0
    static int set_radius(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CircleTrigger obj  = (CircleTrigger)o;
            float         arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.radius = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index radius on a nil value" : e.Message));
        }
    }
Beispiel #5
0
    static int get_radius(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CircleTrigger obj = (CircleTrigger)o;
            float         ret = obj.radius;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index radius on a nil value" : e.Message));
        }
    }