Inheritance: MonoBehaviour
Exemplo n.º 1
0
    void Start()
    {
        rmData    = GetComponent <RadarManager>();
        rocketHUD = GameObject.Find("fake weapon hud").GetComponent <Image>();;
        rocketHUD.gameObject.SetActive(true);
        SpeedReadout    = GameObject.Find("Speed");
        throttleReadout = GameObject.Find("Throttle");

        if (optionalDangerHeightReadout)
        {
            dangerBaseText = optionalDangerHeightReadout.text;
        }

        mFlash = GetComponent <MuzzleFlash>();
        mFlash.Reset();
        StartCoroutine(rocketSalvoRelease());
        shootableScript    = GetComponent <Shootable>();
        wasHealth          = startHealth = shootableScript.healthLimit;
        UI_ThrottleReadout = throttleReadout.GetComponent <UI_Speed> ();
        UI_SpeedReadout    = SpeedReadout.GetComponent <UI_Speed> ();

        hardpointRef = missionTarget.GetComponentInChildren <HardPointCounter>();

        hardpointMax = hardpointRef.hardpointCount;
    }
Exemplo n.º 2
0
    public void ExplodeThis()
    {
        if (alreadyKilledInChain)
        {
            return;
        }
        alreadyKilledInChain = true;

        if (isPlayer && Camera.main == null)
        {
            return;
        }

        // Debug.Log ("KA BOOM");
        if (reportDeath)
        {
            SpawnTicketBooth.instance.reportDeath();
        }

        if (tag == "Hardpoint")
        {
            HardPointCounter hpc = transform.GetComponentInParent <HardPointCounter>();
            hpc.RemoveHardpoint();
        }

        foreach (Transform child in transform)
        {
            if (child.gameObject.tag == "SurviveAfterParentRemoved")
            {
                child.parent = LaserPulseCannon.laserKeeper;
                child.GetComponent <SelfDestruct>().enabled = true;
                ParticleSystem psScript = child.GetComponent <ParticleSystem>();
                if (psScript)
                {
                    psScript.enableEmission = false;
                }
            }
        }

        Collider [] possibleTargets = Physics.OverlapSphere(transform.position, 30.0f);
        foreach (Collider consider in possibleTargets)
        {
            Shootable shootableScript = consider.GetComponent <Shootable>();
            if (shootableScript && shootableScript.healthLimit > 0)
            {
                shootableScript.ExplodeThis();
            }
        }

        GameObject.Instantiate(
            PlayerControl.instance.explodePrefabGeneral,
            transform.position, Quaternion.identity);

        if (isPlayer)
        {
            // Application.LoadLevel( Application.loadedLevel );
            if (GameStateStaticProgress.cheatsOn)
            {
                alreadyKilledInChain = false;                 // so can later die if cheats toggled
            }
            else
            {
                PlayerControl.instance.PlayerDie();
            }
        }
        else
        {
            // explosions always at max volume, high priority gameplay event, play on camera
            if (isMegaShipHardPart)
            {
                SoundCenter.instance.PlayClipOn(
                    SoundCenter.instance.megashipDamage,
                    Camera.main.transform.position, Random.Range(0.4f, 0.7f),
                    Camera.main.transform);
            }
            else
            {
                /* SoundCenter.instance.PlayClipOn(
                 *      SoundCenter.instance.explodeGeneric,
                 *      Camera.main.transform.position, Random.Range(0.25f,0.5f),
                 *      Camera.main.transform); */
            }
            Destroy(gameObject);
        }
    }
Exemplo n.º 3
0
    void Start()
    {
        rmData = GetComponent<RadarManager>();
        rocketHUD = GameObject.Find ("fake weapon hud").GetComponent<Image>();;
        rocketHUD.gameObject.SetActive(true);
        SpeedReadout = GameObject.Find("Speed");
        throttleReadout = GameObject.Find("Throttle");

        if(optionalDangerHeightReadout) {
            dangerBaseText = optionalDangerHeightReadout.text;
        }

        mFlash = GetComponent<MuzzleFlash>();
        mFlash.Reset();
        StartCoroutine(rocketSalvoRelease());
        shootableScript = GetComponent<Shootable>();
        wasHealth = startHealth = shootableScript.healthLimit;
        UI_ThrottleReadout = throttleReadout.GetComponent<UI_Speed> ();
        UI_SpeedReadout = SpeedReadout.GetComponent<UI_Speed> ();

        hardpointRef = missionTarget.GetComponentInChildren<HardPointCounter>();

        hardpointMax = hardpointRef.hardpointCount;
    }
Exemplo n.º 4
0
    void Start()
    {
        mFlash = GetComponent<MuzzleFlash>();
        mFlash.Reset();
        StartCoroutine(rocketSalvoRelease());
        shootableScript = GetComponent<Shootable>();
        wasHealth = startHealth = shootableScript.healthLimit;

        hardpointRef = missionTarget.GetComponentInChildren<HardPointCounter>();

        hardpointMax = hardpointRef.hardpointCount;
    }