Esempio n. 1
0
    public override void OnEnter()
    {
        base.OnEnter();
        var currentShip = HutongGames.PlayMaker.Fsm.EventData.GameObjectData.GetComponent<ShipManager>().ship;// GameManager.Instance.player.player.ships[0];
        container = Fsm.GameObject.GetComponent<ComponentSlotContainer>();

        SetSlot(container.CaptainSlot, currentShip.equipmentSlots[0].component, false);
        SetSlot(container.ChassisSlot, currentShip.equipmentSlots[1].component);
        SetSlot(container.ShieldSlot, currentShip.equipmentSlots[2].component);
        SetSlot(container.EngineSlot, currentShip.equipmentSlots[3].component);
        SetSlot(container.DriveSlot, currentShip.equipmentSlots[4].component);
        SetSlot(container.Weapon1Slot, currentShip.equipmentSlots[5].component);
        SetSlot(container.Weapons2Slot, currentShip.equipmentSlots[6].component);

        container.ShipName.text = currentShip.equipmentSlots[0].component.name;// currentShip.displayName;

        Fsm.GameObject.GetComponent<UIWindow>().Show();
        //PlayMakerFSM.FindFsmOnGameObject(container.CaptainSlot, "FSM").FsmVariables.FindFsmObject("ComponentObject").Value = currentShip.equipmentSlots[0].component;

        //var icons = captainGO.GetComponentsInChildren<Image>();
        //    icons[1].sprite = Sprite.Create(captainComp.Icon, new Rect(0, 0, captainComp.Icon.width, captainComp.Icon.height), new Vector2(0.5f, 0.5f));
        //icons[0].color = Color.white;
        //icons[1].color = Color.white;

        //var chassisGO = Fsm.Variables.FindFsmGameObject("Chassis Slot").Value;
        //var chassisFSM = PlayMakerFSM.FindFsmOnGameObject(chassisGO, "FSM");
        //var chassisComp = currentShip.equipmentSlots[1].component;
        //chassisFSM.FsmVariables.FindFsmObject("ComponentObject").Value = chassisComp;
        //icons = chassisGO.GetComponentsInChildren<Image>();
        //    icons[1].sprite = Sprite.Create(chassisComp.Icon, new Rect(0, 0, chassisComp.Icon.width, chassisComp.Icon.height), new Vector2(0.5f, 0.5f));
        //    icons[0].sprite = Fsm.Variables.FindFsmObject("Slot Filled Sprite").Value as Sprite;
        //icons[1].color = Color.white;

        //chassisGO.GetComponent<UIItemSlot>().hoverNormalColor = Color.white;
        //chassisGO.GetComponent<UIItemSlot>().hoverHighlightColor =Fsm.Variables.GetFsmColor("Hover Color").Value;
        //chassisGO.GetComponent<UIItemSlot>().Assign(Fsm.Variables.FindFsmTexture("Slot Filled Texture").Value);// = true;
        //chassisGO.GetComponent<UIItemSlot>().hoverTargetGraphic.color = chassisGO.GetComponent<UIItemSlot>().hoverNormalColor;

        //Fsm.Variables.FindFsmGameObject("Ship Name").Value.GetComponent<Text>().text = captainComp.name;
        ////equipmentSlots.Add(new CaptainSlot(_script.captainType));
        ////equipmentSlots.Add(new ChassisSlot(_script.chassisType));
        ////equipmentSlots.Add(new ShieldSlot(_script.shieldType));
        ////equipmentSlots.Add(new EngineSlot(_script.engineType));
        ////equipmentSlots.Add(new DriveSlot(_script.driveType));
        ////equipmentSlots.Add(new WeaponSlot(_script.weapon1Type));
        ////equipmentSlots.Add(new WeaponSlot(_script.weapon2Type));
    }
Esempio n. 2
0
 public override void Awake()
 {
     base.Awake();
     container = GetComponent<ComponentSlotContainer>();
     //GetComponent<CanvasRenderer>().relativeDepth = 2;//.sortingLayerName = "ActiveView";
 }