コード例 #1
0
    void ReceivePacket(string data)
    {
        GameObject OwningGame = null;

        GameUtilities.FindGame(ref OwningGame);
        string[] id_data_pair = data.Split(new char[] { ',' }, 2);
        switch (int.Parse(id_data_pair[0]))
        {
        case MoveGunVerticalID:
            OwningGame.BroadcastMessage("MoveGunVertical", ReconstructTankComponentMovementMsg(id_data_pair [1]));
            break;

        case MoveGunHorizontalID:
            OwningGame.BroadcastMessage("MoveGunHorizontal", ReconstructTankComponentMovementMsg(id_data_pair [1]));
            break;

        case MoveTankID:
            OwningGame.BroadcastMessage("MoveTank", ReconstructTankComponentMovementMsg(id_data_pair [1]));
            break;

        case TurnTankID:
            OwningGame.BroadcastMessage("TurnTank", ReconstructTankComponentMovementMsg(id_data_pair [1]));
            break;

        case StrafeTankID:
            OwningGame.BroadcastMessage("StrafeTank", ReconstructTankComponentMovementMsg(id_data_pair [1]));
            break;

        default:
            // No-op?
            break;
        }
    }
コード例 #2
0
    // Use this for initialization

    void Start()
    {
        GameUtilities.FindGame(ref OwningGame);
        BulletSpawnLoc = gameObject.transform.Find("BulletSpawn").gameObject;

        if (BulletSpawnLoc != null)
        {
            print("Found Bullet spawn for player");
        }
        else
        {
            print("Found Bullet spawn NOT for player");
        }

        Left  = KeyCode.H;
        Right = KeyCode.K;

        Up   = KeyCode.U;
        Down = KeyCode.J;

        DeviationX     = 0;
        DeltaY         = 4.0f;
        GunRotateSpeed = 12f;
        FireButton     = KeyCode.Space;
        FrameFired     = Time.frameCount;
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        playerObject      = GameObject.FindGameObjectWithTag("Player"); //find player. hopefully nothing else gets the "Player" tag
        collectableObject = gameObject;                                 //get collectable game object

        if (playerObject != null)
        {
            playerCollider = playerObject.GetComponent <Collider>(); //get collider for intersection detection
        }
        if (collectableObject != null)
        {
            collectableCollider = collectableObject.GetComponent <Collider>(); //get collider for intersection detection
        }
        GameUtilities.FindGame(ref OwningGame);
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        Forward     = KeyCode.W;
        Backward    = KeyCode.S;
        Left        = KeyCode.A;
        Right       = KeyCode.D;
        StrafeLeft  = KeyCode.Z;
        StrafeRight = KeyCode.X;
        TankRot     = 0f;
        //on start up find your parent game
        GameUtilities.FindGame(ref OwningGame);

        StrafeSpeed = 2.0f;
        Stamina     = 100.0f;
        health      = 100.0f;

        IsFinishActive = false;
    }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     GameUtilities.FindGame(ref OwningGame);
     TankAggro  = new SortedDictionary <byte, float>();
     Health     = 100f;
     FrameFired = Time.frameCount;
     Players    = null;
     GameUtilities.GetAllPlayers(ref Players);
     if (Players != null)
     {
         print("Guardian : found " + Players.Length.ToString() + " players");
     }
     BulletSpawnLoc = gameObject.transform.Find("BulletSpawn").gameObject;
     if (BulletSpawnLoc != null)
     {
         print("Guardian Found Bullet Spawn");
     }
     else
     {
         print("Guardian DID NOT Find Bullet Spawn");
     }
 }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     GameUtilities.FindGame(ref OwningGame);
     NoCollisions = 0;
 }
コード例 #7
0
    void ReceivePacket(string data)
    {
        GameObject OwningGame = null;

        GameUtilities.FindGame(ref OwningGame);
        string[] data_pair     = data.Split(new char[] { ',' }, 2);
        string   descriminator = data_pair[0];
        string   payload       = data_pair[1];

        switch (int.Parse(descriminator))
        {
        case LoadNextID:
            GameUtilities.Broadcast("LoadNext", ReconstructLoadNextSceneMsg(payload));
            break;

        case MoveGunVerticalID:
            GameUtilities.Broadcast("MoveGunVertical", ReconstructTankComponentMovementMsg(payload));
            break;

        case MoveGunHorizontalID:
            GameUtilities.Broadcast("MoveGunHorizontal", ReconstructTankComponentMovementMsg(payload));
            break;

        case MoveTankID:
            GameUtilities.Broadcast("MoveTank", ReconstructTankComponentMovementMsg(payload));
            break;

        case TurnTankID:
            GameUtilities.Broadcast("TurnTank", ReconstructTankComponentMovementMsg(payload));
            break;

        case StrafeTankID:
            GameUtilities.Broadcast("StrafeTank", ReconstructTankComponentMovementMsg(payload));
            break;

        case CreateProjectileID:
            GameUtilities.Broadcast("CreateProjectile", ReconstructCreateProjectileMsg(payload));
            break;

        case DamageTankID:
            GameUtilities.Broadcast("DamageTank", ReconstructDamageTankMsg(payload));
            break;

        case DamageEnemyID:
            GameUtilities.Broadcast("DamageEnemy", ReconstructDamageEnemyMsg(payload));
            break;

        case DestroyThisEnemyID:
            GameUtilities.Broadcast("DestroyThisEnemy", ReconstructEnemyIDMsg(payload));
            break;

        case SetIsFinishActiveID:
            GameUtilities.Broadcast("SetIsFinishActive", ReconstructSetIsFinishActiveMsg(payload));
            break;

        case UpdateCollectableTextID:
            GameUtilities.Broadcast("UpdateCollectableText", ReconstructUpdateCollectableTextMsg(payload));
            break;

        case SyncTankPositionID:
            GameUtilities.Broadcast("SyncTankPosition", ReconstructSyncTankPositionMsg(payload));
            break;

        default:
            // No-op?
            break;
        }
    }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     GameUtilities.FindGame(ref OwningGame);
 }
コード例 #9
0
ファイル: FinishPortal.cs プロジェクト: DasBuerger/WonkyTanks
    // private bool isActive;

    // Use this for initialization
    void Start()
    {
        CollectablesLeft = GameObject.FindGameObjectsWithTag("Collectable").Length; //total and remaining collectables set to # collectables in game
        GameUtilities.FindGame(ref OwningGame);
    }