void Start()
 {
     RefillAmmo();
     construction = FindObjectOfType <ConstructionManager>();
     cam          = Camera.main.transform;
     gun          = gameObject.transform.position;
 }
Ejemplo n.º 2
0
    public ConstructionRequests(Vector3 pos)
    {
        GameObject g = GameObject.Instantiate(ConstructionManager.ConstructablePrefab);

        g.transform.position = pos;
        constr = g.GetComponent <Constructable>();
        ConstructionManager.opened.Add(this);
        ConstructionManager.UpdateMissionsQuery();
        go = g;
    }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Debug.LogError("more then once instance of ContructionManager found!");
     }
 }
 private void Awake()
 {
     if (m_instance == null)
     {
         m_instance = this;
     }
     else if (m_instance != this)
     {
         Destroy(this);
     }
 }
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Ejemplo n.º 6
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     currentPhase = ConstructionPhase.NotBuilding;
 }
Ejemplo n.º 7
0
 public void BuildInfrastructure()
 {
     switch (_encampment.EncampmentType)
     {
     case EncampmentType.CAMP:
     case EncampmentType.CAMPMENT:
     case EncampmentType.ENCAMPMENT:
     case EncampmentType.VILLAGE:
     case EncampmentType.FORT:
     default:
         Construct(ConstructionManager.GetConstructionData("shed"));
         break;
     }
 }
Ejemplo n.º 8
0
            public void BuildFreshWaterInfrastructure()
            {
                switch (_encampment.EncampmentType)
                {
                case EncampmentType.CAMP:
                    Construct(ConstructionManager.GetConstructionData("pit"));
                    break;

                case EncampmentType.CAMPMENT:
                case EncampmentType.ENCAMPMENT:
                case EncampmentType.VILLAGE:
                case EncampmentType.FORT:
                    Construct(ConstructionManager.GetConstructionData("well"));
                    break;
                }
            }
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();
            ConstructionManager cm = (ConstructionManager)target;

            if (GUILayout.Button("Ghost Good"))
            {
                cm.GhostGood();
            }
            if (GUILayout.Button("Ghost Bad"))
            {
                cm.GhostBad();
            }
            if (GUILayout.Button("Ungost"))
            {
                cm.UnGhost();
            }
        }
Ejemplo n.º 10
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }
        researchRoot = ResearchController.instance.getResearchTreeRoot();
        UIController.Instance.CreateTurretButtons(researchRoot.getResearchedTurrets().ToList());
        UIController.Instance.CreateStructureBlockButtons(researchRoot.getResearchedSB().ToList());
//        fortBase = new GameObject("FortBase");
        fortBase.tag = "FortBase";
//        DontDestroyOnLoad(gameObject);
    }
Ejemplo n.º 11
0
    void Awake()
    {
        instance = this;

        if (library == null)
        {
            library = GetComponentInChildren <Library>();
        }
        if (moneyManager == null)
        {
            moneyManager = GetComponentInChildren <MoneyManager>();
        }
        if (systemManager == null)
        {
            systemManager = GetComponentInChildren <SystemManager>();
        }
        if (inputManager == null)
        {
            inputManager = GetComponentInChildren <InputManager>();
        }
        if (gridManager == null)
        {
            gridManager = GetComponentInChildren <GridManager>();
        }
        if (cameraManager == null)
        {
            cameraManager = GetComponentInChildren <CameraManager>();
        }
        if (constructionManager == null)
        {
            constructionManager = GetComponentInChildren <ConstructionManager>();
        }
        if (levelManager == null)
        {
            levelManager = GetComponentInChildren <LevelManager>();
        }
        if (enemyManager == null)
        {
            enemyManager = GetComponentInChildren <EnemyManager>();
        }
    }
Ejemplo n.º 12
0
    void Start()
    {
        if (self == null)
        {
            self = GetComponent <RectTransform>();
        }
        ConstructionManager cm = GameManager.instance.constructionManager;

        if (index >= 0 && index < cm.towers.Length)
        {
            icon.sprite    = cm.towers[index].image;
            nameText.text  = cm.towers[index].title;
            priceText.text = cm.towers[index].price.ToString();
            button.onClick.AddListener(() => SelectTower(index));
            gameObject.name = "Buy_" + cm.towers[index].title;
        }
        else
        {
            Debug.Log("undefined tower");
            Destroy(gameObject);
        }
    }
 void EndMission()
 {
     ConstructionManager.Finished(mission, this);
 }
 public GetConstructionJobOrder(ActorController a, ConstructionManager manager) : base()
 {
     center         = a.transform.position;
     targetPosition = center;
     this.manager   = manager;
 }
			private void Awake() {
				foreach (var item in ConstructionManager.GetConstructionDatas()) {
					CreateButton(item);
				}
			}
			private void OnClick(string name) {
				Foreman.Instance.StartPlacement(ConstructionManager.GetConstructionData(name));
			}
Ejemplo n.º 17
0
 // Use this for initialization
 private void Awake()
 {
     instance = this;
     ConstructRoom();
 }
Ejemplo n.º 18
0
 // Use this for initialization
 void Start()
 {
     construction = FindObjectOfType <ConstructionManager>();
     SetDefaultButtons();
 }
 void Start()
 {
     _constructionManager = ConstructionManager.Instance;
 }
 public CompleteConstructionReservation(ActorController actor, ConstructionManager manager) : base()
 {
     this.manager = manager;
 }
Ejemplo n.º 21
0
        void DoClean()
        {
            hasstake  = 0;
            nostake   = 0;
            destroyed = 0;
            num       = 0;
            foreach (GameObject obj in Resources.FindObjectsOfTypeAll <GameObject>())
            {
                if (obj.name.Contains("Constructed") || obj.name.Contains("StructureManager"))
                {
                    var thecell = ConstructionManager.GetOwnershipCell(obj.transform.position);
                    if (thecell != null)
                    {
                        var nView = uLink.NetworkView.Get(obj);
                        if (nView != null && !nView.viewID.ToString().Contains("Unassigned"))
                        {
                            ConstructionManager.Instance.OwnershipCells.TryGetValue(ConstructionManager.GetOwnershipCell(obj.transform.position), out stake);
                            if (stake == null)
                            {
                                nostake++;
                                if (ObjectList.TryGetValue(nView.viewID, out num))
                                {
                                    if (num == Convert.ToInt32(Config["IntervalsBeforeCleaning"]))
                                    {
                                        try
                                        {
                                            Singleton <NetworkManager> .Instance.NetDestroy(nView);

                                            ObjectList.Remove(nView.viewID);
                                            destroyed++;
                                        }
                                        catch {}
                                    }
                                    else
                                    {
                                        ObjectList[nView.viewID] += 1;
                                    }
                                }
                                else
                                {
                                    ObjectList.Add(nView.viewID, 1);
                                }
                            }
                            else
                            {
                                hasstake++;
                                if (ObjectList.TryGetValue(nView.viewID, out num))
                                {
                                    ObjectList.Remove(nView.viewID);
                                }
                            }
                        }
                    }
                }
            }
            SaveObjects();
            if ((bool)Config["ShowConsoleMessages"])
            {
                Puts("Has Stake: " + hasstake);
                Puts("No Stake : " + nostake);
                Puts("Destroyed: " + destroyed);
            }
        }
Ejemplo n.º 22
0
    // Use this for initialization
    void Start()
    {
        // Creating the structure

        testStructure.RootJointID = 1;

        // Creating RootJoint
        Vector3      onePos        = new Vector3(0, 5, 0);
        Quaternion   oneRot        = new Quaternion(0, 0, 0, 0);
        Vector3      Axis          = new Vector3(0, 0, 1);
        float        Rotation      = 0;
        JointStorage jointStorage1 = MakeMethods.MakeJoint(onePos, oneRot, Axis, Rotation, isRoot: true);

        testStructure.JointDict.Add(1, jointStorage1);

        // Creating Link 1 (Body of the robot)
        Vector3     twoPos = new Vector3(0, 4, 0);
        Quaternion  defaultLinkRotation = new Quaternion();
        ObjectSpecs defaultSpecs        = MakeMethods.MakeShape("cube", 5, 1, 5);
        LinkStorage linkStorage1        = MakeMethods.MakeLink(twoPos, defaultLinkRotation, defaultSpecs);

        testStructure.LinkDict.Add(1, linkStorage1);

        // Creating legs (first set)
        Vector3     link2Pos     = new Vector3(2, 2, 2);
        ObjectSpecs defaultLeg   = MakeMethods.MakeShape("cube", 1, 2, 1);
        LinkStorage linkStorage2 = MakeMethods.MakeLink(link2Pos, defaultLinkRotation, defaultLeg);

        testStructure.LinkDict.Add(2, linkStorage2);

        Vector3     link3Pos     = new Vector3(2, 2, -2);
        LinkStorage linkStorage3 = MakeMethods.MakeLink(link3Pos, defaultLinkRotation, defaultLeg);

        testStructure.LinkDict.Add(3, linkStorage3);

        Vector3     link4Pos     = new Vector3(-2, 2, 2);
        LinkStorage linkStorage4 = MakeMethods.MakeLink(link4Pos, defaultLinkRotation, defaultLeg);

        testStructure.LinkDict.Add(4, linkStorage4);

        Vector3     link5Pos     = new Vector3(-2, 2, -2);
        LinkStorage linkStorage5 = MakeMethods.MakeLink(link5Pos, defaultLinkRotation, defaultLeg);

        testStructure.LinkDict.Add(5, linkStorage5);

        // Creating Joint 2
        Vector3      threePos      = new Vector3(2, 3, 2);
        Quaternion   threeRot      = new Quaternion(0, 0, 0, 0);
        Vector3      threeAxis     = new Vector3(0, 0, 1);
        float        threeRotation = 0;
        JointStorage jointStorage2 = MakeMethods.MakeJoint(threePos, threeRot, threeAxis, threeRotation);

        testStructure.JointDict.Add(2, jointStorage2);

        // Creating Joint 3
        Vector3      fourPos       = new Vector3(2, 3, -2);
        Quaternion   fourRot       = new Quaternion(0, 0, 0, 0);
        Vector3      fourAxis      = new Vector3(0, 0, 1);
        float        fourRotation  = 0;
        JointStorage jointStorage3 = MakeMethods.MakeJoint(fourPos, fourRot, fourAxis, fourRotation);

        testStructure.JointDict.Add(3, jointStorage3);

        // Creating Joint 4
        Vector3      fivePos       = new Vector3(-2, 3, 2);
        Quaternion   fiveRot       = new Quaternion(0, 0, 0, 0);
        Vector3      fiveAxis      = new Vector3(0, 0, 1);
        float        fiveRotation  = 0;
        JointStorage jointStorage4 = MakeMethods.MakeJoint(fivePos, fiveRot, fiveAxis, fiveRotation);

        testStructure.JointDict.Add(4, jointStorage4);

        // Creating Joint 5
        Vector3      sixPos        = new Vector3(-2, 3, -2);
        Quaternion   sixRot        = new Quaternion(0, 0, 0, 0);
        Vector3      sixAxis       = new Vector3(0, 0, 1);
        float        sixRotation   = 0;
        JointStorage jointStorage5 = MakeMethods.MakeJoint(sixPos, sixRot, sixAxis, sixRotation);

        testStructure.JointDict.Add(5, jointStorage5);

        // Creating Knee Joints (need to switch axis rotation)
        Vector3      kneeOnePos                = new Vector3(2, 1, 2);
        Quaternion   defaultKneeRotation       = new Quaternion(0, 0, 0, 0);
        Vector3      kneeRotationAxis          = new Vector3(0, 0, 1);
        float        defaultKneeRotationAmount = 0;
        JointStorage kneeOneStorage            = MakeMethods.MakeJoint(kneeOnePos, defaultKneeRotation, kneeRotationAxis, defaultKneeRotationAmount);

        testStructure.JointDict.Add(6, kneeOneStorage);

        Vector3      kneeTwoPos     = new Vector3(2, 1, -2);
        JointStorage kneeTwoStorage = MakeMethods.MakeJoint(kneeTwoPos, defaultKneeRotation, kneeRotationAxis, defaultKneeRotationAmount);

        testStructure.JointDict.Add(7, kneeTwoStorage);

        Vector3      kneeThreePos     = new Vector3(-2, 1, 2);
        JointStorage kneeThreeStorage = MakeMethods.MakeJoint(kneeThreePos, defaultKneeRotation, kneeRotationAxis, defaultKneeRotationAmount);

        testStructure.JointDict.Add(8, kneeThreeStorage);

        Vector3      kneeFourPos     = new Vector3(-2, 1, -2);
        JointStorage kneeFourStorage = MakeMethods.MakeJoint(kneeFourPos, defaultKneeRotation, kneeRotationAxis, defaultKneeRotationAmount);

        testStructure.JointDict.Add(9, kneeFourStorage);

        // Creating Final Leg Links
        Vector3     shinLeg1Pos     = new Vector3(2, -0.5f, 2);
        LinkStorage shinLeg1Storage = MakeMethods.MakeLink(shinLeg1Pos, defaultLinkRotation, defaultLeg);

        testStructure.LinkDict.Add(6, shinLeg1Storage);

        Vector3     shinLeg2Pos     = new Vector3(2, -0.5f, -2);
        LinkStorage shinLeg2Storage = MakeMethods.MakeLink(shinLeg2Pos, defaultLinkRotation, defaultLeg);

        testStructure.LinkDict.Add(7, shinLeg2Storage);

        Vector3     shinLeg3Pos     = new Vector3(-2, -0.5f, 2);
        LinkStorage shinLeg3Storage = MakeMethods.MakeLink(shinLeg3Pos, defaultLinkRotation, defaultLeg);

        testStructure.LinkDict.Add(8, shinLeg3Storage);

        Vector3     shinLeg4Pos     = new Vector3(-2, -0.5f, -2);
        LinkStorage shinLeg4Storage = MakeMethods.MakeLink(shinLeg4Pos, defaultLinkRotation, defaultLeg);

        testStructure.LinkDict.Add(9, shinLeg4Storage);

        // Childrening from the root
        jointStorage1.ChildrenLink = 1;
        jointStorage1.ChildrenJoints.Add(2);
        jointStorage1.ChildrenJoints.Add(3);
        jointStorage1.ChildrenJoints.Add(4);
        jointStorage1.ChildrenJoints.Add(5);

        jointStorage2.ChildrenLink = 2;
        jointStorage2.ChildrenJoints.Add(6);

        jointStorage3.ChildrenLink = 3;
        jointStorage3.ChildrenJoints.Add(7);

        jointStorage4.ChildrenLink = 4;
        jointStorage4.ChildrenJoints.Add(8);

        jointStorage5.ChildrenLink = 5;
        jointStorage5.ChildrenJoints.Add(9);

        kneeOneStorage.ChildrenLink   = 6;
        kneeTwoStorage.ChildrenLink   = 7;
        kneeThreeStorage.ChildrenLink = 8;
        kneeFourStorage.ChildrenLink  = 9;


        // Childrening to the main body
        jointStorage2.ParentLink    = 1;
        jointStorage3.ParentLink    = 1;
        jointStorage4.ParentLink    = 1;
        jointStorage5.ParentLink    = 1;
        kneeOneStorage.ParentLink   = 2;
        kneeTwoStorage.ParentLink   = 3;
        kneeThreeStorage.ParentLink = 4;
        kneeFourStorage.ParentLink  = 5;

        ConstructionManager.GenerateRobot(testStructure); // creates the robot from local data

        // Moving robot a little up just for presentation
        GameObject root = GameObject.Find("Sphere");

        PositionListCreator.CreateDict(root, testList.PList);
        root.transform.Translate(Vector3.up);
    }
Ejemplo n.º 23
0
 void Start()
 {
     gameObject.name += " " + prefabType.ToString();
     ConstructionManager.UpdateMissionsQuery();
 }
Ejemplo n.º 24
0
    private void Update()
    {
        // This is for first movement in the sequence
        if (Input.GetKeyDown(KeyCode.A))
        {
            testList.PList[4].Rotation = -45;
            testList.PList[5].Rotation = -45;
            testList.PList[8].Rotation = 90;
            testList.PList[9].Rotation = 90;
            ObjectJoint.SetJoints(testList, GameObject.Find("Sphere"));
        }

        // This is for the second movement in the sequence (repeate this and 3)
        if (Input.GetKeyDown(KeyCode.S))
        {
            testList.PList[4].Rotation = 45;
            testList.PList[5].Rotation = 45;
            testList.PList[8].Rotation = -90;
            testList.PList[9].Rotation = -90;

            testList.PList[2].Rotation = -45;
            testList.PList[3].Rotation = -45;
            testList.PList[6].Rotation = 90;
            testList.PList[7].Rotation = 90;

            ObjectJoint.SetJoints(testList, GameObject.Find("Sphere"));
        }

        // Third movement in the sequence
        if (Input.GetKeyDown(KeyCode.D))
        {
            testList.PList[4].Rotation = -45;
            testList.PList[5].Rotation = -45;
            testList.PList[8].Rotation = 90;
            testList.PList[9].Rotation = 90;

            testList.PList[2].Rotation = 45;
            testList.PList[3].Rotation = 45;
            testList.PList[6].Rotation = -90;
            testList.PList[7].Rotation = -90;

            GameObject root = GameObject.Find("Sphere");
            root.transform.Translate(Vector3.left * Time.deltaTime * 100);
            ObjectJoint.SetJoints(testList, GameObject.Find("Sphere"));
        }


#if ServerTesting
        // Configuring the robot with server test
        if (Input.GetKeyDown(KeyCode.A))
        {
            RobotStructure test = ClientUDP <RobotStructure> .UDPSend(8888, testStructure);

            ConstructionManager.GenerateRobot(test);
            ObjectJoint.GetJoints(GameObject.Find("Sphere").GetComponent <ObjectJoint>().ChildObjectJoints, GameObject.Find("Sphere"));
        }

        // Moving the thing
        if (Input.GetKeyDown(KeyCode.Space))
        {
            PositionListCreator.CreateList(GameObject.Find("Sphere"), testList.PList);
            PositionList newList = ClientUDP <PositionList> .UDPSend(7777, testList);

            ObjectJoint.SetJoints(newList, GameObject.Find("Sphere"));
        }
#endif
    }
Ejemplo n.º 25
0
 void Start()
 {
     inputManager        = InputManager.Instance;
     constructionManager = ConstructionManager.Instance;
     cityManager         = CityManager.Instance;
 }
Ejemplo n.º 26
0
 public ConstructOrder(ActorController actor, NeolithicObject target)
 {
     manager = target.GetComponent <ConstructionManager>();
     GoToState(cGetConstructionJob, actor);
 }
Ejemplo n.º 27
0
 private void Start()
 {
     cm = FindObjectOfType <ConstructionManager>();
 }