コード例 #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();
    }
コード例 #2
0
    public GameObject TakeHead()
    {
        GameObject go = Instantiate(botHeadPrefab);

        go.GetComponent <BotHead>().Copy(head);
        head = null;
        return(go);
    }
コード例 #3
0
ファイル: BotHead.cs プロジェクト: CoderJet/GGJ2020
    public void Copy(BotHead head)
    {
        renderer = GetComponent <SpriteRenderer>();

        headType = head.headType;
        if (this.animator)
        {
            this.animator.SetInteger("Type", (int)this.headType);
        }
        isBroken        = head.isBroken;
        renderer.sprite = GetSprite();
    }
コード例 #4
0
ファイル: AssetList.cs プロジェクト: CoderJet/GGJ2020
    public void BuildHeadList(Dictionary <HeadType, int> heads)
    {
        Clear();
        BotHead botHead = botHeadPrefab.GetComponent <BotHead>();

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

            menuAsset.Setup(botHead.GetSpriteForType(head.Key), head.Value, head.Key.ToString(), Slot.head);
            menuAsset.list = this;
            Inventory inventory = FindObjectOfType <Inventory>();
            menuAsset.inventory  = inventory;
            menuAsset.controller = controller;
        }
    }
コード例 #5
0
ファイル: AssetList.cs プロジェクト: CoderJet/GGJ2020
    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
        }
    }
コード例 #6
0
 public void FixHead(BotHead head)
 {
     this.head = head;
     head.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
     value += head.Score(type);
 }