Esempio n. 1
0
    public override void ChangeShipEffect(ShipAttri.ShipState state)
    {
        if (state == _attri.Shipstate)
        {
            return;
        }

        if (ship_frame == null || ship_smoke == null || ship_explosion == null ||
            ship_po == null || ship_normal == null)
        {
            return;
        }
        switch (state)
        {
        case ShipAttri.ShipState.AS_IDLE:
        {
            if (sub_smoke != null)
            {
                Destroy(sub_smoke);
            }
            if (sub_explosion != null)
            {
                Destroy(sub_explosion);
            }
            if (ship_explosion_around != null)
            {
                ship_explosion_around.SetActive(false);
            }
            //还原正常的材质球
            if (ship_Body.GetComponent <Renderer>().material != ship_normal)
            {
                ship_Body.GetComponent <Renderer>().material = ship_normal;
            }
            _attri.Shipstate = ShipAttri.ShipState.AS_DEAD;
        }
        break;

        case ShipAttri.ShipState.AS_SMOKE:
        {
            if (sub_smoke != null)
            {
                return;
            }
            sub_smoke = GameObject.Instantiate(ship_smoke);
            sub_smoke.transform.position = ship_frame.transform.position;
            sub_smoke.transform.parent   = ship_frame.transform;

            if (ship_explosion_around != null)
            {
                ship_explosion_around.SetActive(true);
            }

            //替换破损材质球
            if (ship_Body.GetComponent <Renderer>().material != ship_po)
            {
                ship_Body.GetComponent <Renderer>().material = ship_po;
            }
            _attri.Shipstate = ShipAttri.ShipState.AS_SMOKE;
        }
        break;

        case ShipAttri.ShipState.AS_DEAD:
        {
            if (sub_explosion != null)
            {
                return;
            }
            sub_explosion = GameObject.Instantiate(ship_explosion);
            sub_explosion.transform.position = ship_frame.transform.position;
            sub_explosion.transform.parent   = ship_frame.transform;
            _attri.Shipstate = ShipAttri.ShipState.AS_IDLE;

            ShipDestroy();
        }
        break;
        }
    }
Esempio n. 2
0
 public virtual void ChangeShipEffect(ShipAttri.ShipState state)
 {
 }