Ejemplo n.º 1
0
    public void Init(bool onPlanet, PlanetController planetController, bool infestation = false)
    {
        m_planet   = planetController;
        m_onPlanet = onPlanet;
        m_infest   = infestation;
        if (m_onPlanet)
        {
            m_angleOnPlanet = m_planet.GetPestSlot();
            GetComponent <BoxCollider>().isTrigger = true;
            RandomizeMe();
        }
        else
        {
            m_spriteRenderer.sprite = m_diveSprite;

            m_spriteRenderer.color = m_color = Color.white;
            m_direction            = pestDirection(
                m_planet.m_angle,
                m_planet.m_speed,
                new Vector2(transform.position.x, transform.position.y),
                m_diveBombSpeed
                );
            transform.up = m_direction;

            m_rigidBody.velocity = m_direction * m_diveBombSpeed;
        }
    }