Exemple #1
0
    void DiseaseCrowder(GameObject crowderBody)
    {
        PanicManager panicManager = PanicManager.Instance;

        // get real behaviour carrier
        GameObject crowderBehaviourGO = crowderBody.transform.gameObject;

        // cash crowder position
        Vector3 crowderPos = crowderBehaviourGO.transform.localPosition;

        // remove from victims' list and destroy
        panicManager.m_Spawner.m_Crowders.Remove(crowderBehaviourGO);
        Destroy(crowderBehaviourGO);

        GameObject zombi = Instantiate(panicManager.m_DiseasedPrefab, panicManager.m_DiseasedContainer) as GameObject;

        zombi.transform.localScale    = Vector3.one;
        zombi.transform.localPosition = crowderPos;

        ChaserMovement chaserBehaviour = zombi.GetComponent <ChaserMovement>();

        panicManager.m_Chasers.Add(chaserBehaviour);
        panicManager.m_PanicPoints.Add(chaserBehaviour.GetComponent <PanicPoint>());
        chaserBehaviour.Init();
    }
Exemple #2
0
    void OldDiseaseCrowder(GameObject crowderBody)
    {
        // get real behaviour carrier
        GameObject crowderBehaviourGO = crowderBody.transform.parent.gameObject;

        // rename to diseased
        crowderBody.tag        = "Zombi";
        crowderBehaviourGO.tag = "Zombi";

        // disable crowder component
        crowderBehaviourGO.GetComponent <PanicMovement>().enabled = false;

        // introduce disease component
        Disease newZombi = crowderBody.AddComponent <Disease>();

        newZombi.m_Body = newZombi.gameObject.GetComponent <Rigidbody>();

        // introduce panic component
        PanicPoint panicSource = crowderBehaviourGO.AddComponent <PanicPoint>();

        panicSource.m_FearStrength = 1;

        // introduce chaser component
        ChaserMovement chaserBehaviour = crowderBehaviourGO.AddComponent <ChaserMovement>();

        chaserBehaviour.m_Disease = newZombi;

        // change material
        Material newZombiMaterial = newZombi.m_Body.gameObject.GetComponent <Material>();

        newZombiMaterial = PanicManager.Instance.m_DiseaseMaterial;

        PanicManager.Instance.m_Chasers.Add(chaserBehaviour);
        PanicManager.Instance.m_PanicPoints.Add(panicSource);
        chaserBehaviour.Init();
    }