Ejemplo n.º 1
0
    private string buildHairSpritePath(BodyConfig config)
    {
        int hairIndex = (int)(UnityEngine.Random.value * 4) + 1;

        return("Characters/" + this.bodyTypeToPath(config.Body)
               + "/hairs/hair" + hairIndex + this.hairColorTypeToPath(config.Hair));
    }
Ejemplo n.º 2
0
    BodyConfig GenerateBody()
    {
        BodyConfig config = GetNextConfig();

        //config.ChooseSprites();
        return(config);
    }
Ejemplo n.º 3
0
    private void ConstructCanvas(BodyConfig config)
    {
        Image body    = characterCanvas.transform.Find("Body").gameObject.GetComponent <Image>();
        Image hat     = characterCanvas.transform.Find("Hat").gameObject.GetComponent <Image>();
        Image hair    = characterCanvas.transform.Find("Hair").gameObject.GetComponent <Image>();
        Image glasses = characterCanvas.transform.Find("Glasses").gameObject.GetComponent <Image>();
        Image clothes = characterCanvas.transform.Find("Clothes").gameObject.GetComponent <Image>();

        if (config.Hat == BodyHatState.None)
        {
            hat.enabled = false;
        }
        else
        {
            hat.sprite = config.HatSprite;
        }

        if (config.Glasses == BodyGlassesState.None)
        {
            glasses.enabled = false;
        }
        else
        {
            glasses.sprite = config.GlassesSprite;
        }

        body.sprite    = config.BodySprite;
        hair.sprite    = config.HairSprite;
        clothes.sprite = config.ClothesSprite;
    }
Ejemplo n.º 4
0
    private int generateHatIndex(BodyConfig config)
    {
        int numHats = 2;

//		if (config.HatColor == BodyHatColorState.Black)
//			numHats++;

        return((int)(UnityEngine.Random.value * (numHats - 1)) + 1);
    }
Ejemplo n.º 5
0
 private string clothesDir(BodyConfig config)
 {
     if (config.Body == BodyState.HotLady ||
         config.Body == BodyState.FatLady)
     {
         return("dresses");
     }
     else
     {
         return("suits");
     }
 }
Ejemplo n.º 6
0
    public void OnDoneButtonTap()
    {
        //find config with current body
        /*List<BodyConfig>*/
        BodyConfig bodyConf = allBodyConfigs[previewingIndex]; /*ScriptableList<BodyConfig>.instance.list.Where(x => x.preview_body_prefab == spawnedPreviewBodies[previewingIndex]).FirstOrDefault();*/

        Debug.Log("I PICKED BODY - " + bodyConf);
/*        Debug.Log(bodyConf.gender.ToString());*/
        //add this config to savemanager
        SaveManager.Instance.SaveBody(bodyConf);

        Loader.Instance.LoadGameScene(charEditorConfig);
    }
Ejemplo n.º 7
0
    private void Start()
    {
        // FOR TESTING
        //ConversationMaxTime = 8f;
        //ConversationMinTime = 4f;
        //StandMaxTime = 3f;
        //StandMinTime = 2f;
        //InfectMaxTime = 3f;
        //InfectMinTime = 1f;

        // FOR RELEASE
        ConversationMaxTime = 20f;
        ConversationMinTime = 8f;
        StandMaxTime        = 5f;
        StandMinTime        = 10f;
        InfectMaxTime       = 8f;
        InfectMinTime       = 6f;

        if (IsAgent)
        {
            ConversationMaxTime = 8f;
            ConversationMinTime = 4f;
            StandMaxTime        = 5f;
            StandMinTime        = 10f;
        }

        talkedTo = new List <AiPerson>();

        navAgent = GetComponent <NavMeshAgent>();
        navAgent.updatePosition = false;
        navAgent.updateRotation = false;
        navAgent.autoBraking    = true;

        director        = GameObject.FindGameObjectWithTag("Director").GetComponent <Director>();
        player          = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
        characterCanvas = transform.Find("Canvas").gameObject.GetComponent <Canvas>();
        tearPaper       = transform.Find("TearPaper").gameObject.GetComponent <AudioSource>();

        hintCanvas = transform.Find("HintContainer").transform.Find("Hint").gameObject.GetComponent <Canvas>();
        Hint       = hintCanvas.GetComponent <HintBubble>();

        if (!isWaiter && !isPianist)
        {
            BodyConfig = director.GetComponent <BodyGenerator>().GetNextConfig();
            ConstructCanvas(BodyConfig);
        }

        states = StateMachine <AiPersonState> .Initialize(this);

        states.ChangeState(AiPersonState.Idle);
    }
Ejemplo n.º 8
0
        private void PrintBackgrounBody(BodyConfig config)
        {
            if (config.ShowBoarder)
            {
                var spacing         = config.Spacing != 0 ? config.Spacing : 1f;
                var boarderWidth    = config.BoarderWidth != 0 ? config.BoarderWidth : 1;
                var radius          = config.BoardRadius != 0 ? config.BoardRadius : 0;
                var lowerLeftX      = config.LowerLeftX != 0 ? config.LowerLeftX : (_doc.RightMargin - spacing);
                var lowerLeftY      = config.LowerLeftY != 0 ? config.LowerLeftY : (pdfElemment.NextPosition - 50);
                var widthRectangle  = config.WidthRectangle != 0 ? config.WidthRectangle : (_doc.Right - _doc.RightMargin - spacing);
                var heigthRectangle = config.HeigthRectangle != 0 ? config.HeigthRectangle : 50 + spacing;
                var boarderColor    = config.BoarderColor ?? BaseColor.WHITE;
                var backgroundColor = config.BackColor ?? BaseColor.GRAY;

                pdfElemment.Rectangle(lowerLeftX, lowerLeftY, widthRectangle, heigthRectangle, boarderWidth, radius, boarderColor, backgroundColor);
                pdfElemment.HDivision(lowerLeftY);
            }
        }
Ejemplo n.º 9
0
    private void ApplyBodyConfig(BodyConfig bodyCfg)
    {
        //first delete all children
        var allChildren = transform.GetComponentsInChildren <IBodyPrefab>();

        foreach (IBodyPrefab child in allChildren)
        {
            child.gameObject.SetActive(false);
        }

        var body = Instantiate(bodyCfg.game_body_prefab);

        body.transform.SetParent(gameObject.transform);
        body.transform.localPosition = Vector3.zero;
        body.transform.localRotation = Quaternion.identity;

/*        if (body.GetComponent<Animator>() != null)
 *      {
 *          Destroy(body.GetComponent<Animator>());  //cleanUp animator if we have one
 *      }*/


        var animator = body.GetComponent <Animator>();

/*        if (animator == null) body.transform.parent.gameObject.AddComponent<Animator>();*/

        animator.runtimeAnimatorController = bodyCfg.controller;
        animator.avatar          = bodyCfg.avatar;
        animator.applyRootMotion = false;

        if (body.GetComponent <MecanimWrapper>())
        {
            body.GetComponent <MecanimWrapper>().animator = animator;
        }

        skinsManager.skinHolder = body.transform;
/*        skinsManager.PutOnClothes();*/
    }
Ejemplo n.º 10
0
    public BodyConfig GetNextConfig()
    {
        var config = new BodyConfig();

        while (true)
        {
            config.Body     = this.selectRandomFromEnum <BodyState> ();
            config.Face     = this.selectRandomFromEnum <BodyFaceState> ();
            config.Skin     = this.selectRandomFromEnum <BodySkinState> ();
            config.Glasses  = this.selectRandomFromEnum <BodyGlassesState> ();
            config.Hat      = this.selectRandomFromEnum <BodyHatState> ();
            config.Hair     = this.selectRandomFromEnum <BodyHairState> ();
            config.HatColor = this.selectRandomFromEnum <BodyHatColorState> ();
            config.Clothes  = this.selectRandomFromEnum <BodyClothesState> ();
//			config.Clothes = this.selectRandomFromEnum<BodyClothesState> (minClothesIndex, minClothesIndex + maxClothesColors);
//			config.Clothes = this.selectRandomFromArray<BodyClothesState> (this.allowedClothing);

            if (!knownConfigs.ContainsKey(config.hashKey()))
            {
                knownConfigs.Add(config.hashKey(), config);

//				string bodyPath = this.buildBodySpritePath(config);
//				string hairPath = this.buildHairSpritePath(config);
//				string clothesPath = this.buildClothesSpritePath(config);
//				string hatPath = this.buildHatSpritePath(config);
//				string glassesPath = this.buildGlassesSpritePath(config);

                config.BodySprite    = Resources.Load <Sprite> (this.buildBodySpritePath(config));
                config.HairSprite    = Resources.Load <Sprite> (this.buildHairSpritePath(config));
                config.ClothesSprite = Resources.Load <Sprite> (this.buildClothesSpritePath(config));
                config.HatSprite     = Resources.Load <Sprite> (this.buildHatSpritePath(config));
                config.GlassesSprite = Resources.Load <Sprite> (this.buildGlassesSpritePath(config));

                return(config);
            }
        }
    }
Ejemplo n.º 11
0
 private void Initialize()
 {
     if (PhotonNetwork.IsConnectedAndReady)
     {
         if (photon.IsMine) //we spawn body for our player
         {
             currentBodyConfig = saveManager.LoadBody();
             ApplyBodyConfig(currentBodyConfig);
         }
         else if (!photon.IsMine && photon.Owner != null) //we spawn other player bodies
         {
             var             playerProps   = photon.Owner.CustomProperties;
             string          PlayerBodySTR = playerProps["playerWithTeam"].ToString();
             PaintBallPlayer player        = JsonConvert.DeserializeObject <PaintBallPlayer>(PlayerBodySTR);
             ApplyBodyConfig(player.bodyConfigID);
         }
     }
     //we just spawn locally
     else if (saveManager.LoadBody() != null)
     {
         currentBodyConfig = saveManager.LoadBody();
         ApplyBodyConfig(currentBodyConfig);
     }
 }
Ejemplo n.º 12
0
 private string buildGlassesSpritePath(BodyConfig config)
 {
     return("Characters/" + this.bodyTypeToPath(config.Body)
            + "/glasses/" + this.glassesTypeToName(config.Glasses));
 }
Ejemplo n.º 13
0
 private string buildBodySpritePath(BodyConfig config)
 {
     return("Characters/" + this.bodyTypeToPath(config.Body)
            + "/bases/face" + this.faceTypeToPath(config.Face) + this.skinTypeToPath(config.Skin));
 }
Ejemplo n.º 14
0
 public void SaveBody(BodyConfig bodyConfig)
 {
     changableDataConfig.currentBodyConfigId = bodyConfig.ConfigId;
 }
Ejemplo n.º 15
0
    public BodyConfig LoadBody()
    {
        BodyConfig body = ScriptableList <BodyConfig> .instance.GetItemByID(changableDataConfig.currentBodyConfigId);

        return(body);
    }
Ejemplo n.º 16
0
 private string buildClothesSpritePath(BodyConfig config)
 {
     return("Characters/" + this.bodyTypeToPath(config.Body)
            + "/" + this.clothesDir(config) + "/" + this.clothesColorToName(config.Clothes));
 }
Ejemplo n.º 17
0
 private string buildHatSpritePath(BodyConfig config)
 {
     return("Characters/" + this.bodyTypeToPath(config.Body)
            + "/hats/hat" + this.generateHatIndex(config) + this.hatColorToPath(config.HatColor));
 }