Exemplo n.º 1
0
    public void DeactiveFood()
    {
        if (OwnerQuadtree != null)
        {
            OwnerQuadtree.RemoveElement(this);
            OwnerQuadtree = null;
        }

        gameObject.SetActive(false);

        m_Properties = null;

        m_State = State.Notset;
    }
Exemplo n.º 2
0
 public float BeEat(Transform beEatTransform)
 {
     if (m_State == State.Idle)
     {
         m_State = State.BeEat;
         OwnerQuadtree.RemoveElement(this);
         OwnerQuadtree     = null;
         m_BeEatTransform  = beEatTransform;
         m_BeEatRemainTime = slConstants.FOOD_BEEAT_MOVE_TIME;
         return(m_Power);
     }
     else
     {
         return(0);
     }
 }
Exemplo n.º 3
0
    public void ActiveFood(int index, slFoodProperties foodProperties, slFoodPresentation foodPresentation, Vector3 position, Color color, float power)
    {
        m_Index = index;
        m_State = State.Idle;

        gameObject.SetActive(true);

        m_Properties     = foodProperties;
        m_RemainLifeTime = hwmRandom.RandFloat(m_Properties.MinLifeTime, m_Properties.MaxLifeTime);

        m_Presentation = foodPresentation;
        SetPosition(position);

        OwnerQuadtree = slWorld.GetInstance().GetFoodSystem().GetQuadtree();
        AABB          = hwmBox2D.BuildAABB(transform.localPosition, new Vector2(m_Properties.Radius, m_Properties.Radius));
        OwnerQuadtree.UpdateElement(this);

        m_Power = power;
    }
Exemplo n.º 4
0
 public virtual void Deactive()
 {
     OwnerQuadtree.RemoveElement(this);
     Owner = int.MinValue;
 }
Exemplo n.º 5
0
 public void UpdateQuadtree()
 {
     Box  = hwmBox2D.BuildAABB(m_Position, Extent);
     AABB = m_Rotation * Box;
     OwnerQuadtree.UpdateElement(this);
 }
Exemplo n.º 6
0
 protected virtual void UpdateQuadtree()
 {
     AABB = hwmBox2D.BuildAABB(m_Position, new Vector2(Radius, Radius));
     OwnerQuadtree.UpdateElement(this);
 }