Exemple #1
0
    public static void CreateBloodEffect(Transform blood, Vector3 spawnPos, Transform rot)
    {
        Transform          bloodTransform = Instantiate(blood, spawnPos, rot.rotation);
        ParticleSimulation Ps             = bloodTransform.gameObject.AddComponent <ParticleSimulation>();

        Ps.SetUpBloodParticle();
    }
Exemple #2
0
    public static void CreateTrailParticle(Transform particle, Vector3 spawnPos)
    {
        Transform          particleTransform = Instantiate(particle, spawnPos, Quaternion.identity);
        ParticleSimulation Ps = particleTransform.gameObject.AddComponent <ParticleSimulation>();

        Ps.SetupTrailEffect();
    }
Exemple #3
0
    public static void CreateAmmoShell(Transform shell, Vector3 spawnPos, Vector3 move, Transform rot)
    {
        Transform          shellTransform = Instantiate(shell, spawnPos, rot.rotation);
        ParticleSimulation Ps             = shellTransform.gameObject.AddComponent <ParticleSimulation>();

        Ps.Setup(move);
    }
 private void BrowseButton_Click(object sender, EventArgs e)
 {
     DialogResult result = FolderDialog.ShowDialog();
     if (result==System.Windows.Forms.DialogResult.OK)
     {
         _projectManager = new ProjectManager(FolderDialog.SelectedPath);
         _simulation =
             new ParticleSimulation<NodeRenderer, LineRenderer>(0, 0, RenderPanel.Width
                       , RenderPanel.Height
                       , DEFAULT_GRAVITY
                       , DEFAULT_FRICTION_CONSTANT
                       , DEFAULT_STATIC_FRICTION
                       , DEFAULT_SHORT_RESTING_LENGTH
                       , DEFAULT_SPRING_CONSTANT
                       , ForceDissipationFunctionFactory.LinearDissipationFunction(DEFAULT_REPELLANT_FORCE));
         BuildParticles();
         RenderTimer.Enabled = true;
         RenderTimer.Start();
     }
 }
    void Update()
    {
        if (StaticVals.isPaused == true)
        {
            rb.velocity = Vector2.zero;
        }

        if (StaticVals.isPaused == true)
        {
            return;
        }



        Vector2 moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        moveVeocity = moveInput.normalized * speed;

        {
            //Dir
            if (Input.GetKeyDown(KeyCode.W))
            {
                //Up
                Dir      = 1;
                dashTime = startDashTime;
            }
            else if (Input.GetKeyDown(KeyCode.A))
            {
                //Left
                Dir      = 2;
                dashTime = startDashTime;
            }
            else if (Input.GetKeyDown(KeyCode.S))
            {
                //Down
                Dir      = 3;
                dashTime = startDashTime;
            }
            else if (Input.GetKeyDown(KeyCode.A))
            {
                //Right
                Dir      = 4;
                dashTime = startDashTime;
            }


            if (dashTime <= 0)
            {
                rb.velocity = Vector2.zero;
                dashTime    = startDashTime;
                MoveDir     = 0;
            }

            if (MoveDir > 0)
            {
                if (dashTime > 0)
                {
                    if (Dir == 1)//up
                    {
                        rb.velocity = Vector2.up * dashTime;
                    }
                    if (Dir == 2)//left
                    {
                        rb.velocity = Vector2.left * dashTime;
                    }
                    if (Dir == 3)//down
                    {
                        rb.velocity = Vector2.down * dashTime;
                    }
                    if (Dir == 4)//down
                    {
                        rb.velocity = Vector2.right * dashTime;
                    }
                    dashTime -= Time.deltaTime;
                }
            }


            if (Input.GetKeyDown(KeyCode.Space))
            {
                MoveDir = Dir;
            }
        }

        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D))
        {
            PlayerAnim.SetTrigger("isWalking");

            if (timeBtwStep <= 0)
            {
                ParticleSimulation.CreateTrailParticle(pfTrailEffect, shoes.position);
                timeBtwStep = startTimeBtwStep;
            }
        }

        if (timeBtwStep > 0)
        {
            timeBtwStep -= Time.deltaTime;
        }
    }