コード例 #1
0
    public void SetSurface(Game.AddressItem item)
    {
        if (this.surface == null)
        {
            return;
        }

        int index = -1;

        switch (item)
        {
        case Game.AddressItem.Passenger: index = 0; break;

        case Game.AddressItem.Destination: index = 1; break;

        case Game.AddressItem.MoveSpeed: index = 2; break;

        case Game.AddressItem.CameraSpeed: index = 3; break;

        case Game.AddressItem.IncreaseSpawn: index = 4; break;

        case Game.AddressItem.None:
        case Game.AddressItem.Unavailable:
        default: break;
        }

        if (index == -1)
        {
            return;
        }

        this.surface.initialIndex = index;
        this.surface.maxIndex     = index;
    }
コード例 #2
0
ファイル: SampleScene.cs プロジェクト: dolow/taxi-manhattan
    private void GetItem(Game.AddressItem item, int address, int amount)
    {
        switch (item)
        {
        // logical things does nothing
        case Game.AddressItem.Passenger:
        {
            this.mainWalker.PlaySe(Audio.GetSE(Audio.SE.PickUp));
            break;
        }

        case Game.AddressItem.IncreaseSpawn:
        {
            this.mainWalker.PlaySe(Audio.GetSE(Audio.SE.PowerUp));
            break;
        }

        case Game.AddressItem.Destination:
        {
            int score = this.game.GetScore();
            this.scoreText.text = "Score:" + score;
            this.mainWalker.PlaySe(Audio.GetSE(Audio.SE.DropOff));
            break;
        }

        // scene has reponsibility for visible things
        case Game.AddressItem.MoveSpeed:
        {
            this.mainWalker.walkSpeed += this.moveSpeedItemValue;
            this.mainWalker.PlaySe(Audio.GetSE(Audio.SE.PowerUp));
            break;
        }

        case Game.AddressItem.CameraSpeed:
        {
            this.mainCamera.orbitSpeed += this.cameraSpeedItemValue;
            this.mainWalker.PlaySe(Audio.GetSE(Audio.SE.PowerUp));
            break;
        }

        case Game.AddressItem.None:            // noop
        case Game.AddressItem.Unavailable:     // unexpected
        default: return;
        }

        if (this.placedItems.ContainsKey(address))
        {
            ItemBehavior behavior = this.placedItems[address];
            GameObject.Destroy(behavior.gameObject);
            this.placedItems.Remove(address);
        }
    }
コード例 #3
0
ファイル: SampleScene.cs プロジェクト: dolow/taxi-manhattan
    private void PlaceItem(Game.AddressItem item, int address)
    {
        ItemBehavior behavior = GameObject.Instantiate <ItemBehavior>(this.itemPool);
        Vector3      pos      = this.map.addressToPos(address);

        behavior.transform.position = new Vector3(
            pos.x * MapLoader.FieldUnit.x + MapLoader.FieldUnit.x * 0.5f,
            pos.y * this.CurrentFloor() * MapLoader.FieldUnit.y + MapLoader.FieldUnit.y * 0.5f,
            pos.z * MapLoader.FieldUnit.z - MapLoader.FieldUnit.z * 0.5f
            );
        behavior.transform.parent = this.mapRoot.transform;
        behavior.SetSurface(item);
        behavior.SetLookAtCamera(this.mainCamera.GetComponent <Camera>());
        behavior.gameObject.SetActive(true);
        this.placedItems.Add(address, behavior);
    }