コード例 #1
0
        public override BlueSoldier CreateUnit(ObjectSelection objectSelection)
        {
            var prefab       = Resources.Load("Prefabs/BlueSoldier") as GameObject;
            var circlePrefab = Resources.Load("Prefabs/SelectionCircle", typeof(ISelectionIndicationWithShape)) as ISelectionIndicationWithShape;
            var soldier      = UnityEngine.Object.Instantiate(prefab, Vector3.zero, Quaternion.identity);

            soldier.GetComponent <UnitCharacter>().Init(circlePrefab);
            objectSelection.AddNewInitsObject(soldier);
            return(soldier.GetComponent <BlueSoldier>());
        }
コード例 #2
0
        public override Worker CreateUnit(ObjectSelection objectSelection)
        {
            var prefab       = Resources.Load <UnitCharacter>("Prefabs/Worker");
            var circlePrefab = Resources.Load("Prefabs/SelectionCircle", typeof(ISelectionIndicationWithShape)) as ISelectionIndicationWithShape;
            var worker       = UnityEngine.Object.Instantiate(prefab, Vector3.zero, Quaternion.identity);

            worker.Init(circlePrefab);
            objectSelection.AddNewInitsObject(worker.gameObject);
            return(worker.GetComponent <Worker>());
        }