Esempio n. 1
0
    void Awake()
    {
        animator = GetComponent <Animator>();

        BotHeadInstance     = Instantiate(botHeadPrefab, headSocket);
        BotBodyInstance     = Instantiate(botBodyPrefab, bodySocket);
        BotLeftArmInstance  = Instantiate(armPrefab, leftArmSocket);
        BotRightArmInstance = Instantiate(armPrefab, rightArmSocket);
        BotLeftLegInstance  = Instantiate(legPrefab, leftLegSocket);
        BotRightLegInstance = Instantiate(legPrefab, rightLegSocket);

        head = BotHeadInstance.GetComponent <BotHead>();
        body = BotBodyInstance.GetComponent <BotBody>();
        lArm = BotLeftArmInstance.GetComponent <BotArm>();
        rArm = BotRightArmInstance.GetComponent <BotArm>();
        lLeg = BotLeftLegInstance.GetComponent <BotLeg>();
        rLeg = BotRightLegInstance.GetComponent <BotLeg>();

        head.Init();
        body.Init();
        type = body.robotType;
        body.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
        lArm.Init();
        lArm.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
        rArm.Init();
        rArm.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
        lLeg.Init();
        lLeg.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
        rLeg.Init();
        rLeg.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);

        GenerateFaults();
    }
Esempio n. 2
0
    public void Copy(BotBody body)
    {
        renderer = GetComponent <SpriteRenderer>();

        robotType       = body.robotType;
        isBroken        = body.isBroken;
        renderer.sprite = body.GetSprite();
    }
Esempio n. 3
0
    public GameObject TakeBody()
    {
        GameObject go = Instantiate(botBodyPrefab);

        go.GetComponent <BotBody>().Copy(body);
        body = null;
        return(go);
    }
Esempio n. 4
0
        public MainView()
        {
            InitializeComponent();

            ViewModel = new MainViewModel()
            {
                Nav = this.Navigation
            };

            bingSpeechService = new BingSpeechService(new AuthenticationService(ApplicationStore.BingSpeechAPIKey), Device.RuntimePlatform);

            this
            .WhenAnyValue(x => x.ViewModel.DoorState)
            .Subscribe(doorState =>
            {
                if (doorState == DoorState.Open || doorState == DoorState.GoingUp)
                {
                    BotBody.TranslateTo(BotBody.X, BotBody.Y, 2000, Easing.SinIn);
                }
                else if (doorState == DoorState.Closed || doorState == DoorState.GoingDown)
                {
                    BotBody.TranslateTo(BotBody.X, BotBody.Y + 100, 2000, Easing.SinIn);
                }
            });

            this
            .WhenActivated(
                disposables =>
            {
                this.OneWayBind(ViewModel, vm => vm.DoorStateDescription,
                                c => c.DoorStateLabel.Text)
                .DisposeWith(disposables);

                this.BindCommand(ViewModel, vm => vm.GetDevicesCommand,
                                 c => c.RefreshButton)
                .DisposeWith(disposables);

                this.OneWayBind(ViewModel, vm => vm.OpenCloseButtonTitle,
                                c => c.OpenCloseButton.Text)
                .DisposeWith(disposables);

                this.Bind(ViewModel, vm => vm.IsDoorAvailable,
                          c => c.VoiceButton.IsEnabled)
                .DisposeWith(disposables);

                this.BindCommand(ViewModel, vm => vm.ToggleDoorCommand,
                                 c => c.OpenCloseButton)
                .DisposeWith(disposables);

                this.BindCommand(ViewModel, vm => vm.SettingsCommand,
                                 c => c.SettingsBtn)
                .DisposeWith(disposables);
            });
        }
Esempio n. 5
0
    public void BuildBodyList(Dictionary <RobotType, int> bodies)
    {
        Clear();
        BotBody botBody = botBodyPrefab.GetComponent <BotBody>();

        foreach (KeyValuePair <RobotType, int> body in bodies)
        {
            GameObject assetItemInstance = Instantiate(assetItemPrefab, transform);
            MenuAsset  menuAsset         = assetItemInstance.GetComponent <MenuAsset>();

            menuAsset.Setup(botBody.GetSpriteForType(body.Key), body.Value, body.Key.ToString(), Slot.body);
            menuAsset.list = this;
            Inventory inventory = FindObjectOfType <Inventory>();
            menuAsset.inventory  = inventory;
            menuAsset.controller = controller;
        }
    }
Esempio n. 6
0
    public void Menu()
    {
        Inventory inventory = FindObjectOfType <Inventory>();

        BotHead botHead = botHeadPrefab.GetComponent <BotHead>();
        BotBody botBody = botBodyPrefab.GetComponent <BotBody>();
        BotArm  botArm  = armPrefab.GetComponent <BotArm>();
        BotLeg  botLeg  = legPrefab.GetComponent <BotLeg>();

        Clear();

        foreach (KeyValuePair <HeadType, int> head in inventory.heads)
        {
            GameObject assetItemInstance = Instantiate(assetItemPrefab, transform);
            MenuAsset  menuAsset         = assetItemInstance.GetComponent <MenuAsset>();

            menuAsset.SetupCatalog(botHead.GetSpriteForType(head.Key), 1, head.Key.ToString(), Slot.head);// TODO
        }

        foreach (KeyValuePair <RobotType, int> body in inventory.bodies)
        {
            GameObject assetItemInstance = Instantiate(assetItemPrefab, transform);
            MenuAsset  menuAsset         = assetItemInstance.GetComponent <MenuAsset>();

            menuAsset.SetupCatalog(botBody.GetSpriteForType(body.Key), 1, body.Key.ToString(), Slot.body);// TODO
            menuAsset.list       = this;
            menuAsset.inventory  = inventory;
            menuAsset.controller = controller;
        }

        foreach (KeyValuePair <ArmType, int> arm in inventory.arms)
        {
            GameObject assetItemInstance = Instantiate(assetItemPrefab, transform);
            MenuAsset  menuAsset         = assetItemInstance.GetComponent <MenuAsset>();

            menuAsset.SetupCatalog(botArm.GetSpriteForType(arm.Key), 1, arm.Key.ToString(), Slot.leftArm);// TODO
        }

        foreach (KeyValuePair <LegType, int> leg in inventory.legs)
        {
            GameObject assetItemInstance = Instantiate(assetItemPrefab, transform);
            MenuAsset  menuAsset         = assetItemInstance.GetComponent <MenuAsset>();

            menuAsset.SetupCatalog(botLeg.GetSpriteForType(leg.Key), 1, leg.Key.ToString(), Slot.leftLeg);// TODO
        }
    }
Esempio n. 7
0
 public ParceirosDialog()
 {
     botBody     = CarrosselMenu.LerArquivoJsonBot();
     fraseologia = CarrosselMenu.LerFraseologia();
 }
Esempio n. 8
0
 public FundadoresDialog()
 {
     botBody     = CarrosselMenu.LerArquivoJsonBot();
     fraseologia = CarrosselMenu.LerFraseologia();
 }
Esempio n. 9
0
 public GreetingDialog()
 {
     botBody     = CarrosselMenu.LerArquivoJsonBot();
     fraseologia = CarrosselMenu.LerFraseologia();
 }
Esempio n. 10
0
 public void FixBody(BotBody body)
 {
     this.body = body;
     body.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
     value += (this.type == body.robotType) ? 2 : 0;
 }