Пример #1
0
 void Build(GameObject proto)
 {
     if (MyTeam.Data.Credits >= Limits.CostOf(proto.GetComponent <Selectable>().Data.Type))
     {
         GameObject go = Instantiate(proto, this.transform.position, this.transform.rotation);
         go.transform.parent = this.transform;
         Selectable sel = go.GetComponent <Selectable>();
         sel.Data.Team        = MyTeam.Data.TeamID;
         MyTeam.Data.Credits -= Limits.CostOf(sel.Data.Type);
         //send up to buildman
         SendMessageUpwards("PlaceMeNear", go);
     }
 }
Пример #2
0
        //regular build during gameplay
        public GameObject Build(GameObject proto)
        {
            Selectable sel = proto.GetComponent <Selectable>();

            sel.Data.Team = MyTeam.Data.TeamID;
            GameObject go = Instantiate(proto);

            cursor.SetState(Types.SelectionState.BuildAt);
            SendMessage("PlaceMe", go);

            MyTeam.Data.Credits -= Limits.CostOf(sel.Data.Type);
            Limits.RegisterTransaction();
            return(go);
        }