Пример #1
0
        public void Wingを子に持つ()
        {
            Plane plane = new Plane();
            Wing  wing  = new Wing(plane);

            Assert.AreEqual(plane.Wing.Value, wing);
        }
Пример #2
0
    public void Generate(List <Cell> cellList)
    {
        if (cellList.Count < 2)
        {
            return;
        }

        Cell firstCell    = GetRightmostCell(cellList);
        Cell currentCell  = firstCell;
        Cell previousCell = null;

        for (int safe = 0; safe < 1000; safe++)
        {
            Cell nextCell = getNextPeripheryCell(currentCell, previousCell);
            Wing wing     = (GameObject.Instantiate(wingPrefab, transform.position, Quaternion.identity) as Wing);
            wing.transform.parent = transform;
            wing.frontCell        = nextCell;
            wing.backCell         = currentCell;
            wingList.Add(wing);

            if (nextCell == firstCell)
            {
                break;
            }
            previousCell = currentCell;
            currentCell  = nextCell;
        }
    }
Пример #3
0
        private Vector2Int RelativeCoordinateConversion(Wing wing, Vector2Int enemyCoordinates, Vector2Int attackCoordinates)
        {
            Vector2Int convertedVector;

            switch (wing)
            {
            case Wing.port:
                convertedVector = new Vector2Int(enemyCoordinates.x + attackCoordinates.x, enemyCoordinates.y + attackCoordinates.y);
                break;

            case Wing.starboard:
                convertedVector = new Vector2Int(enemyCoordinates.x - attackCoordinates.x, enemyCoordinates.y + attackCoordinates.y);
                break;

            case Wing.bow:
                convertedVector = new Vector2Int(enemyCoordinates.x - attackCoordinates.y, enemyCoordinates.y - attackCoordinates.x);
                break;

            default:
                convertedVector = new Vector2Int(0, 0);
                Debug.LogError("enemy wing is not defined.");
                break;
            }

            return(convertedVector);
        }
        public IHttpActionResult PutWings(int id, Wing  wing)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != wing.Id)
            {
                return BadRequest();
            }

            

            try
            {
                _WingsService.Update(wing);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_WingsService.Exists(id) )
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Пример #5
0
            public int[] GetInstance()
            {
                int[] instance = new int[Perm], order = Wing.Random();
                int   head, remain = MainCycle, current, i = 0;

                current = head = Buffer;
                order[Array.IndexOf(order, head)] = order[0];
                order[0] = head;
                while ((--remain) > 0)
                {
                    i++;
                    instance[current] = order[i];
                    current           = order[i];
                }
                instance[current] = head;
                foreach (var cycle in OtherCycles)
                {
                    remain  = cycle;
                    current = head = order[++i];
                    while ((--remain) > 0)
                    {
                        i++;
                        instance[current] = order[i];
                        current           = order[i];
                    }
                    instance[current] = head;
                }
                return(instance);
            }
Пример #6
0
    private void OnEnable()
    {
        targetWing = target as Wing;

        // Instantiate undoManager
        UndoManager = new HOEditorUndoManager(targetWing, "Wing");
    }
Пример #7
0
    //	Entrance with the most space outward from it
    int BestEntrance(Wing checkWing)
    {
        int entranceIndex   = 0;
        int largestDistance = 0;

        for (int i = 0; i < checkWing.entrances.Count; i++)
        {
            Int2 point = checkWing.entrances[i];
            int  side  = (int)Side(checkWing.entrances[i], checkWing.bounds);

            int[] bounds = new int[] { point.x, point.x, point.z, point.z };

            foreach (Wing wing in wings)
            {
                if (wing.bounds == checkWing.bounds)
                {
                    continue;
                }

                int newDistance = CheckSpace(point, side, bounds, checkWing);
                if (newDistance > largestDistance)
                {
                    entranceIndex   = i;
                    largestDistance = newDistance;
                }
            }
        }

        return(entranceIndex);
    }
Пример #8
0
    //	Get amount of space out from point on side of parent
    int CheckSpace(Int2 point, int side, int[] bounds, Wing parent)
    {
        int space = Distance(PointAxis(point, side), zone.bufferedBounds[side]);

        //	Check all other wings
        for (int w = 0; w < wings.Count; w++)
        {
            //	Ignore parent
            if (wings[w].bounds == parent.bounds)
            {
                continue;
            }

            //	Other wing is overlapping
            if (InOrEitherSide(bounds, wings[w].bounds, side))
            {
                //	Opposide side on overlapping wing
                int oppositeBounds = wings[w].bounds[Zone.Opposite(side)];

                //	Overlapping wing is outwards from this side (not on the other side)
                if (OutwardFrom(bounds[side], oppositeBounds, side))
                {
                    //	If closer than current closest distance, store
                    int distanceToWing = Distance(bounds[side], oppositeBounds);
                    if (distanceToWing < space)
                    {
                        space = distanceToWing;
                    }
                }
            }
        }

        return(space);
    }
Пример #9
0
        public Target CreateTarget(Wing wing, Guid guid, Type type, bool isTrendingEnabled, int displayOrder)
        {
            var result = TargetRepository.New(wing, guid, this.Name);

            result.Description       = this.Description;
            result.ClrType           = type.AssemblyQualifiedName;
            result.IsReferenceTarget = this.IsReferenceTarget;
            result.DisplayOrder      = displayOrder;
            result.IsDisabled        = false;
            result.Publisher         = this.PublisherName ?? "Unknown";
            result.PublisherEmail    = this.PublisherEmail ?? "";
            result.PublisherWebsite  = this.PublisherWebsite ?? "";
            result.IsTrendingEnabled = isTrendingEnabled;
            var assemblyVersion = type.Assembly.GetName().Version;

            result.Version = new Version
            {
                Major     = assemblyVersion.Major,
                Minor     = assemblyVersion.Minor,
                Milestone = assemblyVersion.Revision
                            //Number = string.Format("{0}.{1}.{2}", assemblyVersion.Major, assemblyVersion.Minor,
                            //                       assemblyVersion.Revision)
            };
            return(result);
        }
 // Use this for initialization
 void Start()
 {
     LocalWing = GetComponent<Wing>();
     LocalControlSurface = GetComponent<ControlSurface>();
     LocalPropWash = GetComponent<PropWash>();
     LocalGroundEffect = GetComponent<GroundEffect>();
 }
Пример #11
0
        public FighterGeometry()
        {
            var nose            = new Nose(0.5f, 0.6f, 26, 0.4f);
            var cockpitFuselage = new CockpitFuselage(nose, 1.2f, 1.2f, 3f);
            var mainFuselage    = new MainFuselage(cockpitFuselage);
            var intake          = new EngineIntake(cockpitFuselage);
            var underside       = new Underside(intake);
            var canopy          = new Canopy(0.65f, 0.5f, 3f, 16);
            var wing            = new Wing(4.5f, 4.5f);
            var rear            = new Rear(mainFuselage, underside);
            var tailFin         = new TailFin();
            var stabilizer      = new Stabilizer();
            var exhaust         = new Exhaust(rear, 0.6f);
            var bottomFin       = new BottomFin();

            var path      = exhaust.FlangeEndXSection;
            var graySlide = new Vec3(1f).Interpolate(new Vec3(0f), path.Vertices.Length);

            path.Vertices.Color(graySlide);
            Paths = EnumerableExt.Enumerate(path);

            Fighter = Composite.Create(Stacking.StackBackward(cockpitFuselage.Fuselage, mainFuselage.Fuselage)
                                       .Concat(EnumerableExt.Enumerate(intake.Intake, intake.Belly, underside.Geometry, canopy.Geometry,
                                                                       wing.Geometry, wing.Geometry.ReflectX(), rear.Geometry, exhaust.Geometry,
                                                                       exhaust.StabilizerFlange, exhaust.StabilizerFlange.ReflectX(),
                                                                       tailFin.Geometry, stabilizer.Geometry, stabilizer.Geometry.ReflectX(),
                                                                       bottomFin.Geometry, bottomFin.Geometry.ReflectX())))
                      .Smoothen(0.85f)
                      .Center();
        }
Пример #12
0
 private void RenderRoof(Wing wing, Transform wingFolder)
 {
     if (wing.GetRoof.IsScaled)
     {
         //Debug.Log("Placing with scale " + new Vector3((float)wing.Bounds.max.x, 1.0f, (float)wing.Bounds.max.y));
         PlaceRoof(wing.Bounds.max.x - 1, wing.Bounds.min.y, wing.Stories.Length, wingFolder, wing.GetRoof.Type, wing.GetRoof.Direction,
                   new Vector3((float)wing.Bounds.max.y, 1.0f, (float)wing.Bounds.max.x));
         return;
     }
     for (int x = wing.Bounds.min.x; x < wing.Bounds.max.x; x++)
     {
         for (int y = wing.Bounds.min.y; y < wing.Bounds.max.y; y++)
         {
             for (int i = 0; i < wing.Stories.Length; i++)
             {
                 Story s = wing.Stories[i];
                 if (i < wing.Stories.Length - 1)
                 {
                     if (!wing.Stories[i + 1].Bounds.Contains(new Vector2Int(x, y)))
                     {
                         PlaceRoof(x, y, s.Level + 1, wingFolder, wing.GetRoof.Type, wing.GetRoof.Direction, new Vector3(1.0f, 1.0f, 1.0f));
                         break;
                     }
                 }
                 else if (s.Level == wing.Stories.Length - 1)
                 {
                     PlaceRoof(x, y, s.Level + 1, wingFolder, wing.GetRoof.Type, wing.GetRoof.Direction, new Vector3(1.0f, 1.0f, 1.0f));
                     break;
                 }
             }
         }
     }
 }
    private void OnEnable()
    {
        targetWing = target as Wing;

        // Instantiate undoManager
        UndoManager = new HOEditorUndoManager( targetWing, "Wing" );
    }
Пример #14
0
 // Start is called before the first frame update
 void Start()
 {
     cone   = null;
     engine = null;
     fuel   = null;
     wing   = null;
 }
Пример #15
0
        public void WingSectionを子に持つ()
        {
            Wing        wing        = new Wing(null);
            WingSection wingSection = new WingSection(wing);

            Assert.IsNotNull(wing.PartWings.Where(x => x.Equals(wingSection)).FirstOrDefault());
        }
Пример #16
0
    public void AttachComponent(ShipComponent component)
    {
        if (component.GetShipComponentType() == ShipComponentType.CONE)
        {
            cone = (Cone)component;
            component.PlaceComponent(conePosition);
        }
        else if (component.GetShipComponentType() == ShipComponentType.ENGINE)
        {
            engine = (Engine)component;
            component.PlaceComponent(enginePosition);
        }
        else if (component.GetShipComponentType() == ShipComponentType.FUEL)
        {
            fuel = (Fuel)component;
            component.PlaceComponent(fuelPosition);
        }
        else if (component.GetShipComponentType() == ShipComponentType.WING)
        {
            wing = (Wing)component;
            component.PlaceComponent(wingPosition);
        }

        if (cone != null && engine != null && fuel != null && wing != null)
        {
            SceneManager.LoadScene("WinScene");
        }
    }
Пример #17
0
        public void Componentのコンストラクタを実行する()
        {
            Wing wing = new Wing(null);

            wing.GlobalPos.Value = new Pos(1, 1, 1);
            Assert.AreEqual(wing.GlobalPos.Value, wing.LocalPos.Value);
        }
        /// <summary>
        /// Calculates C_L of the flaps
        /// </summary>
        /// <param name="ld">Wing type that flaps are mounted on</param>
        /// <param name="deployment">Flap extension in the interval [0, 1] to indicate 0-100% flap extension</param>
        /// <returns></returns>
        private static float CalculateFlapsC_L(Wing ld, float deployment = 1)
        {
            var hld = ld.Flaps;

            var d_C_L     = 0f;
            var extension = ld.Flaps.ExtensionRatio;

            // Assuming c'/c = 1.1
            switch (hld.HighLiftDeviceType)
            {
            case HighLiftDeviceType.Plain:
                d_C_L = 0.9f;
                break;

            case HighLiftDeviceType.Single:
                d_C_L = 1.3f * extension;
                break;

            case HighLiftDeviceType.Double:
                d_C_L = 1.6f * extension;
                break;

            case HighLiftDeviceType.Triple:
                d_C_L = 1.9f * extension;
                break;
            }

            d_C_L *= deployment;

            var S_flapped = ld.RootChord * ((Constants.Defaults.HighLiftDevice.FlapStart) + (Constants.Defaults.HighLiftDevice.FlapEnd)) * ld.TaperRatio * (ld.Span * (Constants.Defaults.HighLiftDevice.FlapEnd - Constants.Defaults.HighLiftDevice.FlapStart));

            var D_C_L = d_C_L * (S_flapped / ld.Area) * Mathf.Cos(ld.CalculateSweep(0.95f) * Mathf.Deg2Rad);

            return(D_C_L);
        }
Пример #19
0
 // Use this for initialization
 void Start()
 {
     LocalWing           = GetComponent <Wing>();
     LocalControlSurface = GetComponent <ControlSurface>();
     LocalPropWash       = GetComponent <PropWash>();
     LocalGroundEffect   = GetComponent <GroundEffect>();
 }
Пример #20
0
    public override Wing[] GenerateWings(BuildingSettings settings)
    {
        if (settings.Size.x > 1 && settings.Size.y > 1)
        {
            RectInt firstBounds  = new RectInt(0, 0, settings.Size.x, 1);
            RectInt secondBounds = new RectInt(0, 1, 1, settings.Size.y - 1);

            Wing[] wings = new Wing[2];
            if (settings.wingStrategy != null)
            {
                wings[0] = settings.wingStrategy.GenerateWing(settings, firstBounds, settings.Height());
                wings[1] = settings.wingStrategy.GenerateWing(settings, secondBounds, settings.Height());
            }
            else
            {
                wings[0] = ((WingStrategy)ScriptableObject.CreateInstance <DefaultWingStrategy>()).GenerateWing(settings, firstBounds, settings.Height());
                wings[1] = ((WingStrategy)ScriptableObject.CreateInstance <DefaultWingStrategy>()).GenerateWing(settings, secondBounds, settings.Height());
            }
            return(wings);
        }
        else
        {
            return(new Wing[]
            {
                settings.wingStrategy != null?
                settings.wingStrategy.GenerateWing(settings, new RectInt(0, 0, settings.Size.x, settings.Size.y), settings.Height()) :
                    ((WingStrategy)ScriptableObject.CreateInstance <DefaultWingStrategy>()).GenerateWing(settings, new RectInt(0, 0, settings.Size.x, settings.Size.y), settings.Height()),
            });
        }
    }
Пример #21
0
 void Start()
 {
     mover            = GetComponent <Mover>();
     enemyTarget      = GetComponent <EnemyTarget>();
     combatController = FindObjectOfType <CombatController>();
     spline           = GetComponent <splineMove>();
     savedWing        = GetComponent <EnemyTarget>().wing;
 }
Пример #22
0
        public override void OnAddedToEntity()
        {
            base.OnAddedToEntity();

            wing           = Entity.GetComponent <Wing>();
            mind           = wing.mind;
            mind.inspected = true; // enable trace debug
        }
        public ActionResult WingDelete(int ID)
        {
            Wing w = new Wing();

            w.WingID = ID;
            w.Delete();
            return(RedirectToAction("WingList"));
        }
Пример #24
0
        public IActionResult DeleteWings(string Name)
        {
            Wing dbentry = context.Wings.FirstOrDefault(p => p.Name == Name);

            context.deleteEntry(dbentry);

            return(RedirectToAction(nameof(Home)));
        }
    void OnPlayerSpawn(GameObject player)
    {
        Debug.Log("OnPlayerSpawn");

        this.player = player;
        wing        = player.GetComponent <Wing>();
        controller  = player.GetComponent <Controller>();
    }
        public Wing GetWing(int ID)
        {
            Wing w = new Wing();

            w.WingID = ID;
            w.SelectByID();
            return(w);
        }
Пример #27
0
        /// <summary>
        /// attach this mind to a wing's entity
        /// </summary>
        /// <param name="wing"></param>
        public void attach(Wing wing)
        {
            var nt = wing.Entity;

            nt.AddComponent(new MindComponent(this));

            // load components
            state.me = nt.GetComponent <Wing>();
        }
Пример #28
0
        // Use this for initialization
        void Start()
        {
            wing   = GetComponent <Wing>();
            joint  = GetComponent <Joint>();
            health = GetComponent <Health>();

            initialBreakForce = joint.breakForce;
            initialLift       = wing.liftAxis.magnitude;
        }
Пример #29
0
        public int Create(Wing wing)
        {
            using (var db = new LiteDatabase(_connectionString))
            {
                var collection = db.GetCollection <Wing>(_collectionName);

                return(collection.Insert(wing));
            }
        }
    void Start()
    {
        if (player == null)
        {
            Debug.Log("No Player assigned to GroundSound");
        }

        wing = player.GetComponent <Wing>();
    }
Пример #31
0
        public int getOpinion(Wing wing)
        {
            if (opinion.TryGetValue(wing, out var val))
            {
                return(val);
            }

            return(0);
        }
Пример #32
0
 public WingData(Wing wing)
 {
     uid       = wing.uid;
     name      = wing.name;
     wingClass = wing.wingClass;
     energy    = wing.core.energy;
     ply       = wing.mind.soul.ply;
     armed     = wing.HasComponent <Shooter>();
 }
Пример #33
0
        /// <summary>
        /// wingからElementsを作成
        /// </summary>
        /// <param name="wing"></param>
        public VLM(Wing wing)
        {
            //パネルデータ生成

            /*
             * Pos rf, rr, tf, tr;
             *
             * double yk, ck, osk, dk, ak, xnumk, ynumk, dam0, dam1, dam2, ykp1, ckp1, oskp1, dkp1, akp1, xnumkp1, ynumkp1;
             */
        }
Пример #34
0
        public async Task<ActionResult> Index(int? Id)
        {
            Wing wing = new Wing();
            if (Id != null)
                wing =await  _WingsRepository.GetById(Id.Value.ToString ());


            var Wings = await _WingsRepository.GetAllWithChildren();
            var roomtype =await _RoomTypeRepository.GetAllEnabled();
           
            WingViewModel model = new WingViewModel { List = Wings, Wing = wing, Roomtypes =roomtype };
            return View(model);
        }
Пример #35
0
    // Use this for initialization
    void Start()
    {
        AttachedWing = GetComponent<Wing>();

        if ( null != StallWarnerClip )
        {
            StallWarnerSource = gameObject.AddComponent<AudioSource>();
            StallWarnerSource.clip = StallWarnerClip;
            StallWarnerSource.volume = 1.0f;
            StallWarnerSource.loop = true;
            StallWarnerSource.dopplerLevel = 0.0f;
        }
    }
    // Use this for initialization
    void Start()
    {
        Parent = transform.root.gameObject.GetComponent<Rigidbody>();

        AttachedWing = GetComponent<Wing>();

        if ( null != StallWarnerClip )
        {
            StallWarnerSource = gameObject.AddComponent<AudioSource>();
            StallWarnerSource.clip = StallWarnerClip;
            StallWarnerSource.volume = 1.0f;
            StallWarnerSource.loop = true;
            StallWarnerSource.dopplerLevel = 0.0f;
        }
    }
            public object BindModel(
                ControllerContext controllerContext,
                ModelBindingContext bindingContext,
                MemberDescriptor memberDescriptor)
            {
                List<RoomReservation_RoomDetailsViewDetail> res = new List<RoomReservation_RoomDetailsViewDetail>();
                var form = controllerContext.HttpContext.Request.Form;
                int i = 0;
                while (!string.IsNullOrEmpty(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomTypeId"]))
                {
                    var model = new RoomReservation_RoomDetailsViewDetail();
                    var Wing = new Wing();
                    
                    var RoomReservation_RoomDetails = new RoomReservation_RoomDetails();
                    if (! string.IsNullOrEmpty (form["RoomReservation_RoomDetailsViewModel["+i+"].RoomReservation_RoomDetails.Id"]))
                        RoomReservation_RoomDetails.Id = long.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.Id"]);

                    RoomReservation_RoomDetails.RoomTypeId = int.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomTypeId"]);
                    RoomReservation_RoomDetails.RoomAllocationId = int.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomAllocationId"]);
                    RoomReservation_RoomDetails.Rate = decimal.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.Rate"]);
                    RoomReservation_RoomDetails.Total = decimal.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.Total"]);
                    RoomReservation_RoomDetails.GST_Rate = decimal.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.GST_Rate"]);
                    RoomReservation_RoomDetails.GST_Charges = decimal.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.GST_Charges"]);
                    if (! string.IsNullOrEmpty (form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomReservation_Id"]))
                        RoomReservation_RoomDetails.RoomReservation_Id = long.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomReservation_Id"]);
                    Wing.Id = int.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].Wing.WingId"]);


                    model.Wing = Wing;
                    model.RoomReservation_RoomDetails = RoomReservation_RoomDetails;
                    
                    res.Add(model);
                    i++;
                }

                return res;
             
        }
    // Update is called once per frame
    void Update()
    {
        //Make sure we have a parent wing before we try and do anything and also make sure they are similarly parented.
        if ( (null != ParentWing) && (transform.root.gameObject == ParentWing.transform.root.gameObject) )
        {
            //Do not try and copy self.
            if ( this == ParentWing )
            {
                return;
            }

            //Copy name ( only if changed )
            string newName = ParentWing.name + "(Mirror)";
            if ( gameObject.name != newName )
            {
                gameObject.name = newName;
            }

            //First copy transforms..
            transform.localScale = new Vector3( -ParentWing.transform.localScale.x, ParentWing.transform.localScale.y, ParentWing.transform.localScale.z );
            transform.localPosition = ParentWing.transform.localPosition;
            transform.localPosition = new Vector3( -transform.localPosition.x, transform.localPosition.y, transform.localPosition.z );

            transform.localRotation = new Quaternion( -ParentWing.transform.localRotation.x,
                                                        ParentWing.transform.localRotation.y,
                                                        ParentWing.transform.localRotation.z,
                                                        ParentWing.transform.localRotation.w * -1.0f);

            //Copy wing
            if ( !LocalWing && ParentWing )
            {
                LocalWing = gameObject.AddComponent<Wing>();
            }
            if ( LocalWing && ParentWing )
            {
                LocalWing.SectionCount = ParentWing.SectionCount;
                LocalWing.WingTipWidthZeroToOne = ParentWing.WingTipWidthZeroToOne;
                LocalWing.WingTipSweep = ParentWing.WingTipSweep;
                LocalWing.WingTipAngle = ParentWing.WingTipAngle;
                LocalWing.Aerofoil = ParentWing.Aerofoil;
                LocalWing.CDOverride = ParentWing.CDOverride;
            }
            else if ( LocalWing && !ParentWing )
            {
                //deleted on parent since copying.
                DestroyImmediate( LocalWing );
            }

            //Copy control surface
            ControlSurface parentControlSurface = ParentWing.GetComponent<ControlSurface>();
            if (!LocalControlSurface && parentControlSurface )
            {
                LocalControlSurface = gameObject.AddComponent<ControlSurface>();
            }
            if ( LocalControlSurface && parentControlSurface )
            {
                //string previousLocalAxisName = LocalControlSurface.AxisName;
                GameObject previousModel = LocalControlSurface.Model;
                Vector3 previousRotationAxis = LocalControlSurface.ModelRotationAxis;

                LocalControlSurface.MaxDeflectionDegrees = parentControlSurface.MaxDeflectionDegrees;
                LocalControlSurface.RootHingeDistanceFromTrailingEdge = parentControlSurface.RootHingeDistanceFromTrailingEdge;
                LocalControlSurface.TipHingeDistanceFromTrailingEdge = parentControlSurface.TipHingeDistanceFromTrailingEdge;
                LocalControlSurface.AffectedSections = parentControlSurface.AffectedSections;
                LocalControlSurface.Model = parentControlSurface.Model;
                LocalControlSurface.ModelRotationAxis = parentControlSurface.ModelRotationAxis;

                //Keep the following unique.
                LocalControlSurface.Model = previousModel;
                LocalControlSurface.ModelRotationAxis = previousRotationAxis;
            }
            else if ( LocalControlSurface && !parentControlSurface )
            {
                //deleted on parent since copying.
                DestroyImmediate( LocalControlSurface );
            }

            //Copy propwash
            PropWash parentPropWash = ParentWing.GetComponent<PropWash>();
            if (!LocalPropWash && parentPropWash )
            {
                LocalPropWash = gameObject.AddComponent<PropWash>();
            }
            if ( LocalPropWash && parentPropWash )
            {
                Engine previousPropwashSource = LocalPropWash.PropWashSource;

                //Copy everything except propwash source..
                LocalPropWash.AffectedSections = parentPropWash.AffectedSections;
                LocalPropWash.PropWashSource = parentPropWash.PropWashSource;
                LocalPropWash.PropWashStrength = parentPropWash.PropWashStrength;

                //Keep unique
                LocalPropWash.PropWashSource = previousPropwashSource;
            }
            else if ( LocalPropWash && !parentPropWash )
            {
                //deleted on parent since copying.
                DestroyImmediate( LocalPropWash );
            }

            //Copy groundeffect.
            GroundEffect parentGroundEffect = ParentWing.GetComponent<GroundEffect>();
            if (!LocalGroundEffect && parentGroundEffect )
            {
                LocalGroundEffect = gameObject.AddComponent<GroundEffect>();
            }
            if ( LocalGroundEffect && parentGroundEffect )
            {
                //Copy everything..
                LocalGroundEffect.CLHeightVsChord = parentGroundEffect.CLHeightVsChord;
                LocalGroundEffect.CDHeightVsSpan = parentGroundEffect.CDHeightVsSpan;
                LocalGroundEffect.RayCastAxis = parentGroundEffect.RayCastAxis;
                LocalGroundEffect.RayCastLayers = parentGroundEffect.RayCastLayers;
                LocalGroundEffect.Wingspan = parentGroundEffect.Wingspan;
            }
            else if ( LocalGroundEffect && !parentGroundEffect )
            {
                //deleted on parent since copying.
                DestroyImmediate( LocalGroundEffect );
            }
        }
    }
Пример #39
0
 public void UpdateWing(LuaTable wings)
 {
     List<WingGridData> datas = new List<WingGridData>();
     m_wings.Clear();
     m_grids.Clear();
     m_magic.Clear();
     m_common.Clear();
     int dressed = int.Parse((string)wings["1"]);
     this.dressed = dressed;
     foreach (var item in (LuaTable)wings["2"])
     {
         Wing w = new Wing();
         w.id = int.Parse(item.Key);
         w.level = int.Parse((string)((LuaTable)item.Value)["1"]);
         w.exp = int.Parse((string)((LuaTable)item.Value)["2"]);
         w.active = int.Parse((string)((LuaTable)item.Value)["3"]);
         m_wings.Add(w.id, w);
     }
     foreach (var item in WingData.dataMap)
     {
         WingGridData d = new WingGridData();
         d.wingId = item.Key;
         d.WingName = LanguageData.GetContent(item.Value.name);
         d.WingDescripe = LanguageData.GetContent(item.Value.descrip);
         d.WingIconName = IconData.GetIconPath(item.Value.icon);
         if (m_wings.ContainsKey(item.Key))
         {
             d.WingCurExp = m_wings[item.Key].exp;
             d.WingStarNum = 3;
             d.WingTotalExp = item.Value.GetLevelData(m_wings[item.Key].level).nextLevelExp;
             d.IsHave = true;
             if (item.Value.type == 1)
             {
                 d.WingStatus = "";
             }
             else
             {
                 if (m_wings[item.Key].active == 1)
                 {
                     d.WingStatus = LanguageData.GetContent(26829);
                     d.IsActive = true;
                 }
                 else
                 {
                     d.WingStatus = LanguageData.GetContent(26828);
                     d.IsActive = false;
                 }
             }
             d.WingPrice = "";
         }
         else
         {
             d.WingPrice = "";
             d.WingStarNum = 0;
             d.WingCurExp = 0;
             d.WingTotalExp = 0;
             if (item.Value.type == 1)
             {
                 d.WingStatus = LanguageData.GetContent(26827);
                 d.WingPrice = "" + item.Value.price;
             }
             else
             {
                 d.WingStatus = LanguageData.GetContent(26827);
             }
             d.IsHave = false;
             d.IsActive = false;
             d.IsUsing = false;
         }
         if (item.Value.type == 1)
         {
             if (d.wingId == dressed)
             {
                 d.IsUsing = d.IsHave;
             }
             d.IsActive = d.IsHave;
             m_common.Add(d);
         }
         else
         {
             d.IsHave = true;
             d.IsUsing = true;
             m_magic.Add(d);
         }
         datas.Add(d);
     }
     m_grids = datas;
     CommonWing();
     WingUILogicManager.Instance.SetGold("" + m_self.gold);
     WingUILogicManager.Instance.SetDiamond("" + m_self.diamond);
     UpdateProperty();
     if(opened)
         UpdateUpgradeContent();
 }
 public RoomReservation_RoomDetailsViewDetail()
 {
     RoomReservation_RoomDetails = new RoomReservation_RoomDetails();
     Wing = new Wing();
 }
Пример #41
0
    // Update is called once per frame
    void Update()
    {
        //Make sure we have a parent wing before we try and do anything and also make sure they are similarly parented.
        if ( (null != ParentWing) && (transform.root.gameObject == ParentWing.transform.root.gameObject) )
        {
            //Do not try and copy self.
            if ( this == ParentWing )
            {
                return;
            }

            //Copy name..
            gameObject.name = ParentWing.name + "(Mirror)";

            //First copy transforms..
            transform.localScale = new Vector3( -ParentWing.transform.localScale.x, ParentWing.transform.localScale.y, ParentWing.transform.localScale.z );
            transform.localPosition = ParentWing.transform.localPosition;
            transform.localPosition = new Vector3( -transform.localPosition.x, transform.localPosition.y, transform.localPosition.z );

            transform.localRotation = new Quaternion( -ParentWing.transform.localRotation.x,
                                                        ParentWing.transform.localRotation.y,
                                                        ParentWing.transform.localRotation.z,
                                                        ParentWing.transform.localRotation.w * -1.0f);

            //Copy wing
            if ( !LocalWing && ParentWing )
            {
                LocalWing = gameObject.AddComponent<Wing>();
            }

            if ( LocalWing )
            {
                //EditorUtility.CopySerialized( ParentWing, LocalWing ); //**CRASHES ON 3.5

                LocalWing.SectionCount = ParentWing.SectionCount;
                LocalWing.WingTipWidthZeroToOne = ParentWing.WingTipWidthZeroToOne;
                LocalWing.WingTipSweep = ParentWing.WingTipSweep;
                LocalWing.WingTipAngle = ParentWing.WingTipAngle;
                LocalWing.Aerofoil = ParentWing.Aerofoil;
                LocalWing.CDOverride = ParentWing.CDOverride;
            }

            //Copy control surface
            ControlSurface parentControlSurface = ParentWing.GetComponent<ControlSurface>();
            if (!LocalControlSurface && parentControlSurface )
            {
                LocalControlSurface = gameObject.AddComponent<ControlSurface>();
            }
            if ( LocalControlSurface )
            {
                //string previousLocalAxisName = LocalControlSurface.AxisName;
                bool previousLocalInvert = LocalControlSurface.Invert;
                GameObject previousModel = LocalControlSurface.Model;
                Vector3 previousRotationAxis = LocalControlSurface.ModelRotationAxis;

                //EditorUtility.CopySerialized( parentControlSurface, LocalControlSurface ); //**CRASHES ON 3.5

                LocalControlSurface.AxisName = parentControlSurface.AxisName;
                LocalControlSurface.Invert = parentControlSurface.Invert;
                LocalControlSurface.MaxDeflectionDegrees = parentControlSurface.MaxDeflectionDegrees;
                LocalControlSurface.RootHingeDistanceFromTrailingEdge = parentControlSurface.RootHingeDistanceFromTrailingEdge;
                LocalControlSurface.TipHingeDistanceFromTrailingEdge = parentControlSurface.TipHingeDistanceFromTrailingEdge;
                LocalControlSurface.AffectedSections = parentControlSurface.AffectedSections;
                LocalControlSurface.Model = parentControlSurface.Model;
                LocalControlSurface.ModelRotationAxis = parentControlSurface.ModelRotationAxis;

                //Keep the following unique.
                //LocalControlSurface.AxisName = previousLocalAxisName;
                LocalControlSurface.Invert = previousLocalInvert;
                LocalControlSurface.Model = previousModel;
                LocalControlSurface.ModelRotationAxis = previousRotationAxis;
            }

            //Copy propwash
            PropWash parentPropWash = ParentWing.GetComponent<PropWash>();
            if (!LocalPropWash && parentPropWash )
            {
                LocalPropWash = gameObject.AddComponent<PropWash>();
            }
            if ( LocalPropWash )
            {
                Engine previousPropwashSource = LocalPropWash.PropWashSource;

                //Copy everything except propwash source..
                LocalPropWash.AffectedSections = parentPropWash.AffectedSections;
                LocalPropWash.PropWashSource = parentPropWash.PropWashSource;
                LocalPropWash.PropWashStrength = parentPropWash.PropWashStrength;

                //Keep unique
                LocalPropWash.PropWashSource = previousPropwashSource;
            }
        }
    }
Пример #42
0
        public IHttpActionResult PostWings(Wing wing)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            _WingsService.Create(wing);
        

            return CreatedAtRoute("DefaultApi", new { id = wing.Id }, wing);
        }
    // Calculates the Wing-stroke
    // When there is no strokePower given (e.g. per ArrowKeys) the power is 5
    private void DoWingStroke(Wing welcheSeite, float strokePower = 5)
    {
        // Berechnung der Kräfte
        float calcedForceWing = (forceDivision / 100f);
        float calcedForceMid = (1 - calcedForceWing);

        // Beide Flügel.. 
        if (welcheSeite == Wing.BEIDE)
        {
            // Wirken der Kräfte
            rb_main.AddRelativeForce(rb_main.transform.up * (forceLevel * strokePower), ForceMode.Impulse);
        }
        else // .. oder .. 
        {
            // Bestimmen der Seite
            Vector3 sideVector = welcheSeite == Wing.RECHTS ? -Vector3.up : Vector3.up;
            Vector3 wingPositionVector = welcheSeite == Wing.RECHTS ? rechterFluegel.transform.position : linkerFluegel.transform.position;
            Transform wingTransform = welcheSeite == Wing.RECHTS ? rechterFluegel.transform : linkerFluegel.transform;
            // Wirken der Kräfte
            rb_main.AddForceAtPosition(wingTransform.up * ((forceLevel * strokePower / 5) * calcedForceWing), wingPositionVector, ForceMode.Impulse);
            rb_main.AddRelativeForce(rb_main.transform.up * ((forceLevel * strokePower / 10) * (calcedForceMid)), ForceMode.Impulse);
            /// Leichte Drehung hervorrufen
            rb_main.AddRelativeTorque(sideVector * torqueForce, ForceMode.Impulse);
        }
    }