コード例 #1
0
        public static PV GetPV(int id)
        {
            PV pv = new PV();

            SqlConnection sqlConnection = new SqlConnection(constr);

            sqlConnection.Open();

            string     command    = "Select * from " + table + " Where Id =@id ;";
            SqlCommand sqlCommand = new SqlCommand(command, sqlConnection);

            using (sqlCommand)
            {
                sqlCommand.CommandType = CommandType.Text;
                sqlCommand.Parameters.AddWithValue("@id", id);
                SqlDataReader dataReader = sqlCommand.ExecuteReader();
                if (dataReader.Read())
                {
                    pv.setDate((DateTime)dataReader[2]);
                    pv.setId(id);
                    pv.setNum((int)dataReader[1]);
                }
                dataReader.Close();
            }
            sqlCommand.Dispose();
            sqlConnection.Close();
            return(pv);
        }
コード例 #2
0
 private void OnSceneFinisedLoading(Scene scene, LoadSceneMode mode)
 {
     if (scene.name == instance.gameplayerScene)
     {
         PV.RPC("OnLoadGameScene", RpcTarget.MasterClient);
     }
 }
コード例 #3
0
    void UpdateHeroStats(GameObject hero)
    {
        ElementalStats heroStats  = hero.GetComponent <ElementalStats>();
        PV             heroPV     = hero.GetComponent <PV>();
        Weapons        heroWeapon = hero.GetComponent <Weapons>();

        float lifePower = heroPV.initialHP * (1f + (nbHealthUpgrades / 10f));


        float standardPower = heroStats.initialPower * (1f + (nbStandardUpgrades / 10f));
        int   firePower     = 1 + nbElementalUpgrades[ElementalStats.Element.Fire];
        int   groundPower   = 1 + nbElementalUpgrades[ElementalStats.Element.Ground];
        int   icePower      = 1 + nbElementalUpgrades[ElementalStats.Element.Ice];
        int   windPower     = 1 + nbElementalUpgrades[ElementalStats.Element.Wind];

        int standardAttack = Mathf.CeilToInt(standardPower);

        // Set life
        heroPV.SetPV(lifePower);

        // Set stats
        heroStats.standardPower = Mathf.CeilToInt(standardPower);
        heroStats.stats[ElementalStats.Element.Fire]   = firePower;
        heroStats.stats[ElementalStats.Element.Ground] = groundPower;
        heroStats.stats[ElementalStats.Element.Ice]    = icePower;
        heroStats.stats[ElementalStats.Element.Wind]   = windPower;

        // Set damages
        heroWeapon.damage          = Mathf.CeilToInt(standardPower * 2f);
        heroWeapon.elementalDamage = Mathf.CeilToInt(heroStats.stats[heroStats.selectedElement] * 2f);
    }
コード例 #4
0
ファイル: Sonic.cs プロジェクト: impassionate/CloudComputing
    // Start is called before the first frame update

    public override void PickUpObject()
    {
        if (Player != null)
        {
            PV.RPC("OnPickUp", RpcTarget.AllBufferedViaServer, new object[] { Player.PV.ViewID });
        }
    }
コード例 #5
0
        void EXinfection()
        {
            if (!CheckingTarget)
            {
                return;
            }
            Vector3 DetectCenter = transform.position;

            Collider[] Targets = Physics.OverlapSphere(DetectCenter, 3.5f, 1 << 12);
            if (Targets.Length < 0)
            {
                return;
            }

            foreach (Collider Target in Targets)
            {
                if (Target != null)
                {
                    if (Target.gameObject.tag == "Player")
                    {
                        int ID = Target.gameObject.GetComponent <PhotonView>().ViewID;
                        PV.RPC("MutantTarget", RpcTarget.All, new object[] { ID, PhotonNetwork.LocalPlayer });
                        // MazeGameManager.instance.IncreaseScore(20);
                    }
                }
            }
        }
コード例 #6
0
        protected override void OnInstallPackageFiles(PV version, string packageDirectory)
        {
            var tsPackage        = ThunderstoreAPI.LookupPackage(version.group.DependencyId).First();
            var tsPackageVersion = tsPackage.versions.First(tspv => tspv.version_number.Equals(version.version));
            var filePath         = Path.Combine(packageDirectory, $"{tsPackageVersion.full_name}.zip");

            using (var client = new WebClient())
            {
                client.DownloadFile(tsPackageVersion.download_url, filePath);
            }

            using (var archive = ArchiveFactory.Open(filePath))
            {
                foreach (var entry in archive.Entries.Where(entry => entry.IsDirectory))
                {
                    var path = Path.Combine(packageDirectory, entry.Key);
                    Directory.CreateDirectory(path);
                }

                var extractOptions = new ExtractionOptions {
                    ExtractFullPath = true, Overwrite = true
                };
                foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                {
                    entry.WriteToDirectory(packageDirectory, extractOptions);
                }
            }

            File.Delete(filePath);
        }
コード例 #7
0
 private void Update()
 {
     if (!PV.IsMine)
     {
         return;
     }
     PV.RPC("RPC_Summon", RpcTarget.All);
 }
コード例 #8
0
 public override void use()
 {
     PV.RPC("snap", Photon.Pun.RpcTarget.All, PlayerManager.I.Player.GetComponent <PlayerObject>().head.GetComponent <Photon.Pun.PhotonView>().ViewID, false);
     this.makePhysical(false, true, true);
     this.GetComponent <Rigidbody>().isKinematic = true;
     this.transform.localPosition = new Vector3(0, 0, 0);
     this.transform.rotation      = Quaternion.Euler(0, 0, 0);
     Debug.Log("Owner=" + PV.Owner.ActorNumber + ";Self=" + Photon.Pun.PhotonNetwork.LocalPlayer.ActorNumber);
 }
コード例 #9
0
 public void chargeStats(float multiplier)
 {
     if (PV == null)
     {
         Start();
     }
     this.multiplier = multiplier;
     PV.RPC("RPC_ChargeStats", RpcTarget.All, this.multiplier);
 }
コード例 #10
0
    private void OnLoadGameScene()
    {
        _playersInGame++;

        if (_playersInGame == PhotonNetwork.PlayerList.Length)
        {
            PV.RPC("CreatePlayer", RpcTarget.All);
        }
    }
コード例 #11
0
    // Start is called before the first frame update
    void Start()
    {
        joueur        = GameObject.FindGameObjectWithTag("Player");
        joueurpv      = joueur.GetComponent <PV>();
        joueurFloatPv = joueurpv.pv;

        monsterDeplacement = this.gameObject.GetComponent <MonsterDeplacement>();
        monsterState       = monsterDeplacement.state;
    }
コード例 #12
0
 public void BroadcastGlobal <T, U, O, P, Q>(string command, T arg1, U arg2, O arg3, P arg4, Q arg5)
 {
     if (IsInRoom())
     {
         PV.RPC("SendBroadcast", RpcTarget.All, typeof(T).FullName, typeof(U).FullName, typeof(O).FullName, typeof(P).FullName, typeof(Q).FullName, command, arg1, arg2, arg3, arg4, arg5);
     }
     else
     {
         BroadcastLocal <T, U, O, P, Q>(command, arg1, arg2, arg3, arg4, arg5);
     }
 }
コード例 #13
0
    void activate()
    {
        Vector2 moveDir = playerMovement.LastMoveDirection.normalized;

        rb2d.velocity          = moveDir * dashDistance / dashDuration;
        dashStartTime          = Time.time;
        playerMovement.enabled = false;
        playerController.processAbility(this);
        onDash?.Invoke(true);
        PV.RPC("RPC_OnDash", RpcTarget.Others, true);
    }
コード例 #14
0
 public void BroadcastGlobal <T, U>(string command, T arg1, U arg2)
 {
     if (IsInRoom())
     {
         PV.RPC("SendBroadcast", RpcTarget.All, typeof(T).FullName, typeof(U).FullName, command, arg1, arg2);
     }
     else
     {
         BroadcastLocal <T, U>(command, arg1, arg2);
     }
 }
コード例 #15
0
        public ArchivedPVContract(PV pv)
            : this()
        {
            ParamIs.NotNull(() => pv);

            Author = pv.Author;
            Name = pv.Name;
            PVId = pv.PVId;
            Service = pv.Service;
            PVType = pv.PVType;
        }
コード例 #16
0
        public ArchivedPVContract(PV pv)
            : this()
        {
            ParamIs.NotNull(() => pv);

            Author  = pv.Author;
            Name    = pv.Name;
            PVId    = pv.PVId;
            Service = pv.Service;
            PVType  = pv.PVType;
        }
コード例 #17
0
 void deactivate()
 {
     if (dashStartTime >= 0)
     {
         dashStartTime          = -1;
         rb2d.velocity          = Vector2.zero;
         playerMovement.enabled = true;
         playerController.processAbility(this, false);
         onDash?.Invoke(false);
         PV.RPC("RPC_OnDash", RpcTarget.Others, false);
     }
 }
コード例 #18
0
        public string GetInfos()
        {
            string info = name + "\n" +
                          Age.ToString() + "\n" +
                          PV.ToString() + "\n" +
                          Gender.ToString() + "\n" +
                          this.GetType().ToString() + "\n" +
                          WasAttacked.ToString() + "\n" +
                          Target.ToString();

            return(info);
        }
コード例 #19
0
 public void BroadcastGlobal(string command)
 {
     if (IsInRoom())
     {
         PV.RPC("SendBroadcast", RpcTarget.All, command);
         //PhotonNetwork.RaiseEvent
     }
     else
     {
         BroadcastLocal(command);
     }
 }
コード例 #20
0
ファイル: PVContract.cs プロジェクト: realzhaorong/vocadb
        public PVContract(PV pv)
        {
            ParamIs.NotNull(() => pv);

            Author = pv.Author;
            Id = pv.Id;
            Name = pv.Name;
            PVId = pv.PVId;
            Service = pv.Service;
            PVType = pv.PVType;
            Url = pv.Url;
        }
コード例 #21
0
ファイル: PVContract.cs プロジェクト: sethura/vocadb
        public PVContract(PV pv)
        {
            ParamIs.NotNull(() => pv);

            Author  = pv.Author;
            Id      = pv.Id;
            Name    = pv.Name;
            PVId    = pv.PVId;
            Service = pv.Service;
            PVType  = pv.PVType;
            Url     = pv.Url;
        }
コード例 #22
0
ファイル: PVContract.cs プロジェクト: sethura/vocadb
        public PVContract(VideoUrlParseResult parseResult, PVType type)
        {
            ParamIs.NotNull(() => parseResult);

            Author   = parseResult.Author;
            Name     = parseResult.Title;
            PVId     = parseResult.Id;
            Service  = parseResult.Service;
            ThumbUrl = parseResult.ThumbUrl;
            PVType   = type;

            Url = PV.GetUrl(Service, PVId);
        }
コード例 #23
0
        public PVContract(PV pv)
        {
            ParamIs.NotNull(() => pv);

            Author           = pv.Author;
            ExtendedMetadata = pv.ExtendedMetadata;
            Id          = pv.Id;
            Name        = pv.Name;
            PVId        = pv.PVId;
            Service     = pv.Service;
            PublishDate = pv.PublishDate;
            PVType      = pv.PVType;
            Url         = pv.Url;
        }
コード例 #24
0
ファイル: PVContract.cs プロジェクト: rijuntun/vocadb
        public PVContract(VideoUrlParseResult parseResult, PVType type)
        {
            ParamIs.NotNull(() => parseResult);

            Author      = parseResult.Author;
            Length      = parseResult.LengthSeconds ?? 0;
            Name        = parseResult.Title;
            PVId        = parseResult.Id;
            PublishDate = parseResult.UploadDate;
            Service     = parseResult.Service;
            ThumbUrl    = parseResult.ThumbUrl;
            PVType      = type;

            Url = PV.GetUrl(Service, PVId);
        }
コード例 #25
0
        public double FreeFallTime(Orbit orb, double startUT,
                                   Vector3d vel, Vector3d pos, double end_altitude, double dt,
                                   out Vector3d terminal_velocity, out Vector3d end_position)
        {
            var R = Body.Radius + end_altitude;
            var p = new PV {
                pos = pos.xzy, vel = vel.xzy, alt = pos.magnitude - R
            };
            var m       = (double)VSL.Physics.M;
            var s       = (double)VSL.Geometry.BoundsSideAreas.MinComponentF();
            var started = false;
            var UT      = startUT;
            var endUT   = startUT + orb.timeToPe;

            while (p.alt > 0 && UT < endUT)
            {
                var sv      = p.vel - Vector3d.Cross(Body.angularVelocity, p.pos);
                var svm     = sv.magnitude;
                var drag_dv = drag(s, p.alt, svm) / m * dt;
                started |= drag_dv > 0.1;
                UT       = startUT + p.time;
                if (started)
                {
                    var r = p.pos.magnitude;
                    p.vel -= p.pos * Body.gMagnitudeAtCenter / r / r / r * dt + sv / svm * Math.Min(drag_dv, svm);
                    p.pos += p.vel * dt;
                }
                else
                {
                    p.vel = orb.getOrbitalVelocityAtUT(UT).xzy;
                    p.pos = orb.getRelativePositionAtUT(UT).xzy;
                }
                p.alt   = p.pos.magnitude - R;
                p.time += dt;
                if (dt > 0.01 && p.alt / svm < dt)
                {
                    dt = p.alt / svm * 0.9;
                }
                //                Utils.Log("h {}, t {}, dt {}, pos {}, vel {}",
                //                          p.alt, p.time, dt, p.pos, p.vel);//debug
            }
            terminal_velocity = p.vel.xzy;
            end_position      = p.pos.xzy;
            return(p.time);
        }
コード例 #26
0
        public static void ModifyPV(int id, PV newPV)
        {
            SqlConnection sqlConnection = new SqlConnection(constr);

            sqlConnection.Open();

            string     command    = "UPDATE " + table + " SET num=@num,date=@date WHERE Id=@id ;";
            SqlCommand sqlCommand = new SqlCommand(command, sqlConnection);

            using (sqlCommand)
            {
                sqlCommand.CommandType = CommandType.Text;

                sqlCommand.Parameters.AddWithValue("@num", newPV.getNum());
                sqlCommand.Parameters.AddWithValue("@date", newPV.getDate());
                sqlCommand.Parameters.AddWithValue("@Id", id);
                sqlCommand.ExecuteNonQuery();
            }
            sqlCommand.Dispose();
            sqlConnection.Close();
        }
コード例 #27
0
        public static void DeletePV(PV pv)
        {
            SqlConnection sqlConnection = new SqlConnection(constr);

            sqlConnection.Open();

            String command = "DELETE FROM  " + table + " WHERE Id = @ID";;


            SqlCommand sqlCommand = new SqlCommand(command, sqlConnection);

            using (sqlCommand)
            {
                sqlCommand.CommandType = CommandType.Text;

                sqlCommand.Parameters.AddWithValue("@ID", pv.getId());

                sqlCommand.ExecuteNonQuery();
            }
            sqlCommand.Dispose();
            sqlConnection.Close();
        }
コード例 #28
0
        public override async Task OnInstallPackageFiles(PV version, string packageDirectory)
        {
            var tsPackage        = ThunderstoreAPI.LookupPackage(version.group.DependencyId).First();
            var tsPackageVersion = tsPackage.versions.First(tspv => tspv.version_number.Equals(version.version));
            var filePath         = Path.Combine(packageDirectory, $"{tsPackageVersion.full_name}.zip");

            ThunderstoreAPI.DownloadPackage(tsPackageVersion, filePath);

            while (!File.Exists(filePath))
            {
                await Task.Delay(1);
            }

            using (var fileStream = File.OpenRead(filePath))
                using (var archive = new ZipArchive(fileStream))
                    foreach (var entry in archive.Entries)
                    {
                        var outputPath = Path.Combine(packageDirectory, entry.FullName);
                        var outputDir  = Path.GetDirectoryName(outputPath);
                        if (entry.FullName.ToLower().EndsWith("/") || entry.FullName.ToLower().EndsWith("\\"))
                        {
                            if (!Directory.Exists(outputPath))
                            {
                                Directory.CreateDirectory(outputPath);
                            }
                            continue;
                        }

                        if (!Directory.Exists(outputDir))
                        {
                            Directory.CreateDirectory(outputDir);
                        }

                        entry.ExtractToFile(outputPath);
                    }

            File.Delete(filePath);
        }
コード例 #29
0
        public static void AddPV(PV pv)
        {
            SqlConnection sqlConnection = new SqlConnection(constr);

            sqlConnection.Open();

            String command = "INSERT INTO " + table + "VALUES(@id,@num,@date);";

            SqlCommand sqlCommand = new SqlCommand(command, sqlConnection);

            using (sqlCommand)
            {
                sqlCommand.CommandType = CommandType.Text;

                sqlCommand.Parameters.AddWithValue("@id", pv.getId());
                sqlCommand.Parameters.AddWithValue("@num", pv.getNum());
                sqlCommand.Parameters.AddWithValue("@date", pv.getDate());

                sqlCommand.ExecuteNonQuery();
            }
            sqlCommand.Dispose();
            sqlConnection.Close();
        }
コード例 #30
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            //Create the tracing service
            ITracingService tracingService = executionContext.GetExtension <ITracingService>();

            //Create the context
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);
            // Obtain the runtime value of the Text input argument


            //string text = context.GetValue(this.Text);
            //Entity loan = (Entity)context.InputParameters["Target"];
            decimal apr = APR.Get(executionContext);
            decimal pv  = PV.Get(executionContext);
            int     n   = N.Get(executionContext);

            decimal r  = (apr / 100) / 12;
            decimal mp = (r * pv) / (1 - Convert.ToDecimal(Math.Pow((1 + Decimal.ToDouble(r)), -n)));

            MP.Set(executionContext, mp);



            //Entity loanImage = (Entity)context.PreEntityImages["LoanImage"];

            //  if (loan.Attributes.Contains("rev_monthlypayments"))
            // {
            //monthlypayments = ((Money)loan.Attributes["rev_monthlypayments"]).Value;
            //monthlypayments = mp;

            // }
            //((Money)loan.Attributes["rev_monthlypayments"]).Value = mp;

            //service.Update(loan);
        }
コード例 #31
0
        protected override void OnInstallPackageFiles(PV version, string packageDirectory)
        {
            var potentialPackages = Directory.GetFiles(LocalRepositoryPath, "*.zip", SearchOption.TopDirectoryOnly);

            foreach (var filePath in potentialPackages)
            {
                using (var archive = ArchiveFactory.Open(filePath))
                {
                    var manifestJsonEntry = archive.Entries.First(entry => entry.Key.Contains("manifest.json"));
                    var manifestJson      = string.Empty;
                    using (var reader = new StreamReader(manifestJsonEntry.OpenEntryStream()))
                        manifestJson = reader.ReadToEnd();

                    var version_full_name = Path.GetFileNameWithoutExtension(filePath);
                    var author            = version_full_name.Split('-')[0];
                    var manifest          = JsonUtility.FromJson <PackageVersion>(manifestJson);
                    var full_name         = $"{author}-{manifest.name}";
                    if (full_name != version.group.DependencyId)
                    {
                        continue;
                    }

                    foreach (var entry in archive.Entries.Where(entry => entry.IsDirectory))
                    {
                        Directory.CreateDirectory(Path.Combine(packageDirectory, entry.Key));
                    }

                    var extractOptions = new ExtractionOptions {
                        ExtractFullPath = true, Overwrite = true
                    };
                    foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                    {
                        entry.WriteToDirectory(packageDirectory, extractOptions);
                    }
                }
            }
        }
コード例 #32
0
ファイル: GameManager.cs プロジェクト: AdhavanT/Photon-FPS
 /// <summary>
 /// SpawnPlayer instantiates the local player and assignes it a spawn location and a team and sets up scoreboard.
 /// </summary>
 public void SpawnPlayer()
 {
     if (PlayerManager.LocalPlayerInstance == null)
     {
         if (PhotonNetwork.CurrentRoom.PlayerCount % 2 == 0)
         {
             int rand = UnityEngine.Random.Range(-4, 4);
             rand *= 10;
             Vector3    SpawnVector = new Vector3(25.7f, 1.117f, rand);
             GameObject player      = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "Player"), SpawnVector, Quaternion.identity);
             PhotonView PV;
             PV = player.GetComponent <PhotonView>();
             PV.RPC("SetTeamTag", RpcTarget.AllBuffered, "Blue");
             if (!PhotonNetwork.IsMasterClient)
             {
                 PV.RPC("InitializePlayer", RpcTarget.MasterClient);
             }
             Debug.Log("Spawning local player of Blue team");
         }
         else
         {
             int rand = UnityEngine.Random.Range(-4, 4);
             rand = rand * 10;
             Vector3    SpawnVector = new Vector3(-25.7f, 1.117f, rand);
             GameObject player      = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "Player"), SpawnVector, Quaternion.identity);
             PhotonView PV;
             PV = player.GetComponent <PhotonView>();
             PV.RPC("SetTeamTag", RpcTarget.AllBuffered, "Red");
             if (!PhotonNetwork.IsMasterClient)
             {
                 PV.RPC("InitializePlayer", RpcTarget.MasterClient);
             }
             Debug.Log("Spawning local player of Red team");
         }
     }
 }
コード例 #33
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public static PV PV_Reverse(PV v)
 {
     return new PV(-v.x, -v.y, -v.z);
 }
コード例 #34
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public static PV PV_Sum(PV p1, PV p2)
 {
     return new PV(p1.x + p2.x, p1.y + p2.y, p1.z + p2.z);
 }
コード例 #35
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public static PV PV_Norm(PV v)
 {
     double l = v.Length();
     return new PV(v.x / l, v.y / l, v.z / l);
 }
コード例 #36
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public static PV PV_Mul(PV v, double mul)
 {
     return new PV(v.x * mul, v.y * mul, v.z * mul);
 }
コード例 #37
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public static double PV_DotProduct(PV v1, PV v2)
 {
     return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
 }
コード例 #38
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public static double PV_Dist(PV p1, PV p2)
 {
     return Math.Sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y) + (p1.z - p2.z) * (p1.z - p2.z));
 }
コード例 #39
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public static double PV_CosAngle2V(PV v1, PV v2)
 {
     return PV_DotProduct(v1, v2) / (v1.Length() * v2.Length());
 }
コード例 #40
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public static PV PV_Subt(PV p1, PV p2)
 {
     return new PV(p1.x - p2.x, p1.y - p2.y, p1.z - p2.z);
 }
コード例 #41
0
ファイル: Geometry.cs プロジェクト: xbit123/raytracer
 public Ray(PV start, PV endORdir, bool isFrom2Points)
 {
     if (isFrom2Points)
     {
         this.start = start;
         this.dir = PV_Norm(PV_Subt(endORdir, start));
     }
     else
     {
         this.start = start;
         this.dir = PV_Norm(endORdir);
     }
 }