Exemplo n.º 1
0
    public override void InitStart(bool isThisMine)
    {
        base.InitStart(isThisMine);

        for (int i = 0; i < laserFieldGuns.Length; i++)
        {
            LaserShoot ls = laserFieldGuns[i].GetComponent <LaserShoot>();
            ls.playerOwner = playerOwner;
            ls.InitStart();
        }

        if (OperationNetwork.isServer)
        {
            randomLaserDefinition = new float[laserFieldGuns.Length * 4];
            for (int i = 0; i < laserFieldGuns.Length; i++)
            {
                RotateLaser rL = laserFieldGuns[i].GetComponent <RotateLaser>();
                rL.InitStartServer();
                randomLaserDefinition [i * 4 + 0] = rL.rotX;
                randomLaserDefinition [i * 4 + 1] = rL.rotY;
                randomLaserDefinition [i * 4 + 2] = rL.changeX;
                randomLaserDefinition [i * 4 + 3] = rL.changeY;
            }
        }
    }
Exemplo n.º 2
0
 public override void ServerSyncFixedUpdate()
 {
     base.ServerSyncFixedUpdate();
     for (int i = 0; i < laserFieldGuns.Length; i++)
     {
         RotateLaser rL = laserFieldGuns[i].GetComponent <RotateLaser>();
         rL.UpdateLaser(getLifeTimeServer());
     }
 }
Exemplo n.º 3
0
    public override int SetInformation(object[] data, object[] a, object[] b, bool isThisFirstTick, bool isThisMine)
    {
        int previousTotal = base.SetInformation(data, a, b, isThisFirstTick, isThisMine);

        // Doesn't even bother setting randomLaserDefinition if it isn't null. (It doesn't change during its life time)
        if (randomLaserDefinition.Length == 0)
        {
            randomLaserDefinition = (float[])data [previousTotal];
            for (int i = 0; i < laserFieldGuns.Length; i++)
            {
                RotateLaser rL = laserFieldGuns[i].GetComponent <RotateLaser>();
                rL.InitStartClient(randomLaserDefinition, i);
            }
        }

        for (int i = 0; i < laserFieldGuns.Length; i++)
        {
            RotateLaser rL = laserFieldGuns[i].GetComponent <RotateLaser>();
            rL.UpdateLaser(getLifeTimeInterp());
        }

        return(previousTotal + 1);
    }