Пример #1
0
    public void Spawn()
    {
        int   l   = 0;
        float max = maxCount;

        /*if (!ITimecycle.night) {
         *      max = maxCount / 2;
         * }*/
        if (human)
        {
            l = DataCenter.dataCenter.humans.Length;
        }
        else
        {
            l = DataCenter.dataCenter.zombies.Length;
        }
        if ((l < max && limit > 0) || (!IHuman.playerObj && human))
        {
            GameObject sp = (GameObject)Resources.Load("Prefabs/ZombieRag_" + Random.Range(0, 1));
            if (!human)
            {
                sp = Instantiate(sp, transform.position + (Vector3)Vector0.Flat(Random.onUnitSphere), Quaternion.identity, transform);
                IZombie z = sp.GetComponent <IZombie> ();
                z.findMode       = isFinders;
                z.savable.health = 100 + IZombie.dead * 10;
            }
            else
            {
                if (IHuman.playerObj)
                {
                    sp = (GameObject)Resources.Load("Prefabs/HumanRag");
                    sp = Instantiate(sp, transform.position + (Vector3)Vector0.Flat(Random.onUnitSphere), Quaternion.identity, transform);
                    IHuman h = sp.GetComponent <IHuman> ();
                    h.savable.name = "BOT";
                    Destroy(h.camObj);
                }
                else
                {
                    sp = (GameObject)Resources.Load("Prefabs/Human");
                    sp = Instantiate(sp, transform.position + (Vector3)Vector0.Flat(Random.onUnitSphere), Quaternion.identity, transform);
                    IHuman h = sp.GetComponent <IHuman> ();
                    h.savable.name = "player";
                    IHuman.GetPlayer();
                    ITimecycle.UpdateCameras();
                }
            }
        }
        if (limited)
        {
            limit -= 1;
        }
        if (!IsInvoking("Spawn"))
        {
            Invoke("Spawn", interval + Random.Range(0f, interval));
        }
    }
Пример #2
0
 private void Update()
 {
     if (player)
     {
         Sinhro();
     }
     else
     {
         player = IHuman.GetPlayer();
     }
     Cursor.lockState = CursorLockMode.Locked;
     Cursor.visible   = false;
 }
Пример #3
0
    private void CheckVisible()
    {
        IHuman h = IHuman.GetPlayer();

        if (h && IHuman.cameraMain && IHuman.cameraTransformMain)
        {
            float   angle  = IHuman.cameraMain.fieldOfView;
            Vector3 myDir  = (head.position - h.trans.position).normalized;
            Vector3 hisDir = IHuman.cameraTransformMain.forward;
            bool    headV  = Vector3.Angle(myDir, hisDir) < angle;
            myDir = ((trans.position + (head.position - trans.position).normalized) - h.trans.position).normalized;
            bool middle = Vector3.Angle(myDir, hisDir) < angle;
            myDir = (trans.position - h.trans.position).normalized;
            bool foot = Vector3.Angle(myDir, hisDir) < angle;
            SetVisible(headV || middle || foot);
        }
    }