コード例 #1
0
 public void ClearToChange()
 {
     SentCubes.Clear();
     if (CurrentConstruct != null)
     {
         CurrentConstruct.Reset();
     }
     for (int i = 0; i < CubesLoc.Count; i++)
     {
         CubesLoc[i].SetActive(true);
     }
     for (int i = 0; i < CubesLoc.Count; i++)
     {
         if (i < ConstructsObtained[ConstructIndex].RequiredCubes)
         {
             SentCubes.Add(CubesLoc[i]);
         }
         else
         {
             CubesLoc[i].SetActive(false);
             CubesLoc[i].transform.position = transform.position;
         }
     }
     CurrentConstruct = ConstructsObtained[ConstructIndex];
     CurrentConstruct.SetUp(transform, PlayerNum);
     CurrentConstruct.ChangeInto(SentCubes);
 }
コード例 #2
0
 /// <summary>
 /// TODO: Require actual implementation
 /// need to fix icon param, it should not be units sprite,
 /// but a mix of construct and unit(or whatever implementation you favour),
 /// it's just something to make it compile for now
 /// </summary>
 public static StrongholdData Create(ConstructData constructData, UnitData unitData) =>
 new StrongholdData(
     unitData.Icon,
     $"{constructData.Name} captured by : {unitData.Name}",
     constructData,
     unitData
     );
コード例 #3
0
        private bool TryGetConstructFromInspectable(IInspectable inspectable, out ConstructData data)
        {
            switch (inspectable)
            {
            case InspectableCoordinate inspectableCoordinate:
                if (_currentMap.TryGet <Construct>(inspectableCoordinate.Coordinate, out var construct))
                {
                    data = construct?.Data;
                    return(true);
                }
                else if (_currentMap.TryGet <Stronghold>(inspectableCoordinate.Coordinate, out var stronghold))
                {
                    data = stronghold?.Data?.ConstructData;
                    return(true);
                }

                data = default;
                return(false);

            case PaletteData <Preset <ConstructData> > paletteData:
                data = paletteData.Data.Data;
                return(true);

            default:
                data = default;
                return(false);
            }
        }
コード例 #4
0
    protected override void OnUpdate()
    {
        var   commandBuffer = m_EntityCommandBufferSystem.CreateCommandBuffer();
        float deltaTime     = Time.DeltaTime;
        float elapsedTime   = (float)Time.ElapsedTime;

        Entities.
        WithAll <FlyingRobotTag>().
        ForEach((Entity entity, ref Rotation rot, ref Translation trans
                 , ref RobotMovementData robotMovementData, in ParentGoliathData parentGoliathData) =>
        {
            if (robotMovementData.lerpValue < 1)
            {
                robotMovementData.lerpValue += deltaTime;
                trans.Value = Vector3.Lerp(robotMovementData.startPos, robotMovementData.target, robotMovementData.lerpValue);
                rot.Value   = Quaternion.LookRotation(robotMovementData.targetNormal, new float3(0, 1, 0));
            }
            else
            {
                ConstructData constructData = EntityManager.GetComponentData <ConstructData>(parentGoliathData.goliath);
                constructData.currentNrOfAttachedRobots++;
                AttachedRobotsData attachedRobotsData = EntityManager.GetComponentObject <AttachedRobotsData>(parentGoliathData.goliath);
                attachedRobotsData.attachedRobots[robotMovementData.claimedPolygon] = entity;

                EntityManager.SetComponentData(parentGoliathData.goliath, constructData);
                EntityManager.SetComponentData(parentGoliathData.goliath, attachedRobotsData);

                commandBuffer.RemoveComponent(entity, typeof(FlyingRobotTag));
                commandBuffer.AddComponent(entity, typeof(AttachedRobotTag));
            }
        })
        .WithoutBurst()
        .Run();
    }
コード例 #5
0
    public void Awake()
    {
        for (int i = 0; i < transform.childCount; i++)
        {
            CubesLoc.Add(transform.GetChild(i).gameObject);
        }
        if (ConstructDirectory.IsLoaded == false)
        {
            ConstructDirectory.Load();
        }
        ConstructDisplayed = new ConstructData();
        ConstructDisplayed = ConstructDirectory.GetRandom();
        List <GameObject> SentCubes = new List <GameObject>();

        for (int i = 0; i < CubesLoc.Count; i++)
        {
            if (i < ConstructDisplayed.RequiredCubes)
            {
                CubesLoc[i].SetActive(true);
                SentCubes.Add(CubesLoc[i]);
            }
            else
            {
                CubesLoc[i].transform.position = transform.position;
                CubesLoc[i].SetActive(false);
            }
        }
        ConstructDisplayed.SetUp(this.transform, 0);
        ConstructDisplayed.ChangeInto(SentCubes);
    }
コード例 #6
0
    public static ConstructData Find(int Index)
    {
        ConstructData temp = Directory[Index].Clone();

        temp.ConstructContained = new Constructs(Directory[Index].ConstructContained);
        conNum++;
        return(temp);
    }
コード例 #7
0
    public static ConstructData GetRandom()
    {
        int Index = 0;

        Index = Random.Range(0, Directory.Count);
        ConstructData temp = Directory[Index].Clone();

        temp.ConstructContained = new Constructs(Directory[Index].ConstructContained);
        return(temp);
    }
コード例 #8
0
    public GameObject GenerateConstruct(Construct construct, Vector3 position, ConstructData constructData, Transform parent)
    {
        GameObject construct_temp = Instantiate(construct.constructPrefab, parent);

        construct_temp.AddComponent <ConstructSlot>().constructData = constructData;
        construct_temp.GetComponent <ConstructSlot>().construct     = construct;

        construct_temp.transform.localEulerAngles = new Vector3(0, constructData.rotation, 0);
        construct_temp.transform.localPosition    = position;
        construct_temp.name = construct_temp.name = constructData.constructID + "" + constructData.x + "" + constructData.z;

        return(construct_temp);
    }
コード例 #9
0
 public static ConstructData Find(ConstructType Name)
 {
     for (int i = 0; i < Directory.Count; i++)
     {
         if (Directory[i].isType == Name)
         {
             ConstructData temp = Directory[i].Clone();
             temp.ConstructContained = new Constructs(Directory[i].ConstructContained);
             temp.isType             = Name;
             conNum++;
             return(temp);
         }
     }
     return(null);
 }
コード例 #10
0
        public static BluePrintConstruct ConvertFromLevelConstructToBluePrint(List <GameEvent> gameEvents)
        {
            BluePrintConstructBuilder builder = BluePrintConstructBuilder.CreateBluePrint();

            List <GameEvent> gameEventsToDeploy = gameEvents;

            foreach (GameEvent gEvent in gameEventsToDeploy)
            {
                ConstructData constructData = gEvent.ConstructData;

                builder.AddConstructData(constructData);
            }

            return(builder.Build());
        }
コード例 #11
0
        public GameEvent(string name, string mJsonData, int mLevel, int mCost, string mType, int offset = 0)
        {
            this.mName = name;
            //this.mJsonData = mJsonData;
            this.mLevel = mLevel;
            this.mCost  = mCost;
            this.mType  = mType;

            ConstructData        = Utils.ParseJsonData <ConstructData>(mJsonData);
            ConstructData.Offset = offset;
            //mCanAttachToUp = new List<GameEventType>() ;
            //mCanAttachToForward = new List<GameEventType>();
            //mCanAttachToDown = new List<GameEventType>();
            //mAttachments = new Dictionary<AttachmentType, List<GameEventType>>();
            //mAttachments.Add(AttachmentType.Up, mCanAttachToUp);
            //mAttachments.Add(AttachmentType.Forward, mCanAttachToForward);
            //mAttachments.Add(AttachmentType.Down, mCanAttachToDown);
        }
コード例 #12
0
 void Awake()
 {
     rb = GetComponent <Rigidbody>();
     if (PlayerList == null)
     {
         PlayerList = new List <CubePlayer>();
         Players    = new string[4];
     }
     AssignPlayer();
     DontDestroyOnLoad(this.gameObject);
     for (int i = 0; i < transform.childCount; i++)
     {
         if (gameObject.transform.GetChild(i).gameObject.tag == "Cube")
         {
             CubesLoc.Add(gameObject.transform.GetChild(i).gameObject);
         }
     }
     if (ConstructDirectory.IsLoaded == false)
     {
         ConstructDirectory.Load();
     }
     ConstructsObtained    = new ConstructData[4];
     ConstructsObtained[0] = (ConstructDirectory.Find(ConstructType.CubeGuy));
     ConstructsObtained[1] = (ConstructDirectory.Find(ConstructType.Turret));
     ConstructsObtained[2] = (ConstructDirectory.Find(ConstructType.Car));
     ConstructsObtained[3] = (ConstructDirectory.Find(ConstructType.Tank));
     SentCubes             = new List <GameObject>();
     Menu = new MenuControl(MenuObj, this);
     for (int i = 0; i < CubesLoc.Count; i++)
     {
         if (i < ConstructsObtained[0].RequiredCubes)
         {
             SentCubes.Add(CubesLoc[i]);
         }
         else
         {
             CubesLoc[i].transform.position = transform.position;
             CubesLoc[i].SetActive(false);
         }
     }
     CurrentConstruct = ConstructsObtained[0];
     CurrentConstruct.SetUp(this.transform, PlayerNum);
     CurrentConstruct.ChangeInto(SentCubes);
 }
コード例 #13
0
    public virtual ConstructData Clone()
    {
        ConstructData temp = new ConstructData();

        return(temp);
    }
コード例 #14
0
 private StrongholdData(Sprite icon, string name, ConstructData constructData, UnitData unitData) :
     base(icon, name)
 {
     ConstructData = constructData;
     UnitData      = unitData;
 }
コード例 #15
0
 public void AddConstructData(ConstructData data)
 {
     constructDataList.Add(data);
 }
コード例 #16
0
 private void OnUpdatePreset(ConstructData data)
 {
     nameText.text    = $"Name: {data.Name}";
     iconImage.sprite = data.Icon;
 }
コード例 #17
0
 public BluePrintConstructBuilder AddConstructData(ConstructData imageMap)
 {
     mBluePrint.AddConstructData(imageMap);
     return(this);
 }
コード例 #18
0
 void Awake()
 {
     Test = GetComponent <ConstructData>();
 }