Пример #1
0
 public void Hit()
 {
     timeKeeper.Reset("hit", 10f + (float)rnd.NextDouble() * 15.0f);
     if (PhotonNetwork.IsMasterClient)
     {
         HitShipAction hitShip = new HitShipAction(this);
         hitShip.DamageRooms();
         string indexeddata = actionCounter + "," + hitShip.Serialize();
         myPhotonView.RPC("RPC_AddAction", RpcTarget.All, indexeddata);
     }
     actionCounter++;
 }
Пример #2
0
    private void RPC_AddAction(string data, PhotonMessageInfo info)
    {
        string[] actionData      = data.Split(',');
        Action   actionToPerform = new Action(this);

        switch (actionData[1])
        {
        case "hitShip":
            actionToPerform = new HitShipAction(this);
            break;

        case "move":
            actionToPerform = new MoveAction(this);
            break;

        case "search":
            actionToPerform = new SearchAction(this);
            break;

        case "repair":
            actionToPerform = new RepairAction(this);
            break;

        case "heal":
            actionToPerform = new HealAction(this);
            break;

        case "boostShields":
            actionToPerform = new BoostShieldsAction(this);
            break;

        case "share":
            actionToPerform = new ShareAction(this);
            break;

        case "suffocate":
            actionToPerform = new SuffocateAction(this);
            break;
        }

        actionToPerform.Deserialize(actionData);
        actions.Add(int.Parse(actionData[0]), actionToPerform);
    }