Exemplo n.º 1
0
        public BowlScript Spawn(Bowl body, Transform parent)
        {
            var bowl = Instantiate(this, parent);

            bowl.ID   = body.ID;
            bowl.Body = body;
            body.StoneIDs.ForEach(x =>
            {
                var target = bowl.transform.position;
                target.x  -= body.Position == Position.Score ? 0 : 7.6f;
                target.y  += body.Position == Position.Score ? 6 - 1 : 3;
                target.z  += body.Position == Position.Score ? -0.5f : 0;
                if (!Access.BodyDataExists(x))
                {
                    new StoneBodyData(x, target, Quaternion.identity);
                }
                if (GameResources.IsContinue)
                {
                    GameResources
                    .Stones[Mathf.Abs(x.GetHashCode() % GameResources.Stones.Count)]
                    .Spawn(new StoneBody(x), bowl.transform);
                }
                else
                {
                    GameResources.Queue.SpawnStone(x, body.ID, body.Owner, body.Position);
                }
            });
            return(bowl);
        }