コード例 #1
0
ファイル: Ninja.cs プロジェクト: israelmo7/UnityProject
    override protected void InitSkills(Transform owner)
    {
        Skill.SetGST(GameObject.Find("Manager").GetComponent <GlobalScriptTeam>());

        Transform attackPoint = owner.GetChild(2);


        Fist     fist     = new Fist(owner, "Fist", 10, 1, 0, 1f, Skill.SkillType.Melee, attackPoint, 100);
        Shuriken shuriken = new Shuriken(owner, "Shuriken", 25, 3, 10, 3f, Skill.SkillType.Ranged, 1000, 4, attackPoint);
        Grenade  grenade  = new Grenade(owner, "Grenade", 35, 12, 15, 10, Skill.SkillType.Ranged, 500, 5, attackPoint);

        _skills.set((int)AbilityType.Stype.None, fist);
        _skills.set((int)AbilityType.Stype.None, shuriken);
        _skills.set((int)AbilityType.Stype.None, grenade);

        FireBall fireBall = new FireBall(owner, "FireBall", 35, 3, 15, 3f, Skill.SkillType.Ranged, 1000, 4, attackPoint);

        _skills.set((int)AbilityType.Stype.Fire, fist);
        _skills.set((int)AbilityType.Stype.Fire, fireBall);

        Tornado tornado = new Tornado(owner, "Tornado", 100, 0, 20, 15, Skill.SkillType.OnArea, 5, 5);

        _skills.set((int)AbilityType.Stype.Wind, fist);
        _skills.set((int)AbilityType.Stype.Wind, tornado);
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        stars = transform.Find("Stars").gameObject;
        stars.SetActive(false);
        rb = GetComponent <Rigidbody2D>();
        rb.freezeRotation = true;
        me           = GetComponent <PlayerInfo>();
        camScript    = cam.GetComponent <Camera2DFollow>();
        playerNum    = me.playerNum;
        inventory    = GetComponent <Inventory>();
        mycolor      = GetComponent <SpriteRenderer>().color;
        aimIndicator = transform.Find("AimIndicator").gameObject;
        aimIndicator.GetComponent <SpriteRenderer>().color = mycolor;
        SetControls();
        //Idle
        timeSinceLastMoved = 0f;
        idle   = false;
        idleLF = false;

        // movement
        pMovCurrentSpeed = speed;
        pMovHandle       = pMovHandleBase;

        // punching
        fist = transform.Find("Fist").GetComponent <Fist>();
        transform.FindDeepChild("FistSprite").GetComponent <SpriteRenderer>().color = mycolor;
    }
コード例 #3
0
 private async void FistAndChain()
 {
     Log.Debug("starting combo");
     while (Config.FistAndComboKey.Value.Active)
     {
         var target = Selector.Active.GetTargets().FirstOrDefault();
         if (target != null)
         {
             if (Fist.CanBeCasted() && Fist.CanHit(target))
             {
                 Fist.UseAbility(target.Position);
                 Log.Debug("Fist usages");
                 await Task.Delay(25);
             }
             if (Chains.CanBeCasted())
             {
                 if (Me.Distance2D(target) <= 400)
                 {
                     Chains.UseAbility();
                     Log.Debug("Chains usages");
                     await Task.Delay(100);
                 }
             }
         }
         await Task.Delay(1);
     }
 }
コード例 #4
0
ファイル: Fist.cs プロジェクト: rileywhite/Funship
 internal SFist(dynamic head, Fist tail)
 {
     if (nilf.Equals(head))
     {
         throw new ArgumentException("DFist head cannot be nilf");
     }
     this.head = head;
     this.tail = tail;
 }
コード例 #5
0
ファイル: SandboxMod.cs プロジェクト: kononena/SandboxMod
 public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
 {
     if (celRanger)
     {
         CelRanger.ApplyDebuffs(target);
     }
     if (fist)
     {
         Fist.ApplyDebuffs(target);
     }
 }
コード例 #6
0
ファイル: Engineer.cs プロジェクト: israelmo7/UnityProject
    override protected void InitSkills(Transform owner)
    {
        Skill.SetGST(GameObject.Find("Manager").GetComponent <GlobalScriptTeam>());

        Transform attackPoint = owner.GetChild(2);
        Fist      fist        = new Fist(owner, "Fist", 10, 1, 0, 1f, Skill.SkillType.Melee, attackPoint, 100);
        Shuriken  shuriken    = new Shuriken(owner, "Shuriken", 25, 3, 10, 3f, Skill.SkillType.Ranged, 1000, 4, attackPoint);
        Grenade   grenade     = new Grenade(owner, "Grenade", 35, 12, 15, 10, Skill.SkillType.Ranged, 500, 5, attackPoint);

        _skills.set(fist);
        _skills.set(shuriken);
        _skills.set(grenade);
    }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        rb             = GetComponent <Rigidbody2D> ();
        bc             = GetComponent <BoxCollider2D> ();
        weaponSlots    = new Weapon[4];
        weaponSlots[0] = new Fist();
        inHands        = weaponSlots[0];

        weaponSlotLeft.GetComponent <SpriteRenderer> ().sortingLayerName  = "Weapons";
        weaponSlotRight.GetComponent <SpriteRenderer> ().sortingLayerName = "Weapons";

        weaponSlotLocationLeft  = weaponSlotLeft.transform.localPosition;
        weaponSlotLocationRight = weaponSlotRight.transform.localPosition;
    }
コード例 #8
0
ファイル: Program.cs プロジェクト: tkbcode/RockPaperScissors
    public static int?Comparison(Fist Fist1, Fist Fist2)
    {
        switch (Fist1.State())
        {
        case FistType.rock:
            switch (Fist2.State())
            {
            case FistType.rock:
                return(0);

            case FistType.paper:
                return(-1);

            case FistType.scissors:
                return(1);
            }
            break;

        case FistType.paper:
            switch (Fist2.State())
            {
            case FistType.rock:
                return(1);

            case FistType.paper:
                return(0);

            case FistType.scissors:
                return(-1);
            }
            break;

        case FistType.scissors:
            switch (Fist2.State())
            {
            case FistType.rock:
                return(-1);

            case FistType.paper:
                return(1);

            case FistType.scissors:
                return(0);
            }
            break;
        }
        return(null);
    }
コード例 #9
0
        public void LateStart()
        {
            _startPosition = m_Player.m_Transform.position.z;

            Fist selectedFist = Systems.GameState.Instance.SelectedFist;

            if (selectedFist != null)
            {
                m_Player.m_FistSprite.sprite = selectedFist.m_Sprite.sprite;
            }

            GameEventsController.Instance.OnSetFist          += SetFistSprite;
            GameEventsController.Instance.OnPointerUpDown    += CheckInput;
            GameEventsController.Instance.OnGameStateChanged += CheckState;
            GameEventsController.Instance.OnShowHitAnimation += ShowHitAnimation;
        }
コード例 #10
0
    public void Trigger(Fist fist, Vector3 force)
    {
        fists[fist.handIndex] = fist;

        float pvpc = ProductVertPC();

        HUD.shared.SetProp("VertPC", pvpc.ToString());

        if (indicatorRenderer.enabled)
        {
            return;
        }

        moveForce[fist.handIndex] = force;

        bool moveToHeadDirection = true;

        if (Mathf.Abs(pvpc) > 1.0f)
        {
            //triggered

            indicatorRenderer.enabled = true;

            fists[0].ResetVerticalPowerCharge();
            fists[1].ResetVerticalPowerCharge();

//            float sign = Mathf.Sign(pvpc);

            moveVelocity = new Vector3(
                (moveForce[0].x + moveForce[1].x) * pvpc * 2.0f,
                moveForce[0].y + moveForce[1].y,
                (moveForce[0].z + moveForce[1].z) * pvpc * 2.0f
                );

            if (moveToHeadDirection)
            {
                moveVelocity   = Player.instance.hmdTransforms[0].forward * moveVelocity.magnitude * pvpc * 2.0f;
                moveVelocity.y = 0.0f;
            }

            transform.position = Player.instance.hmdTransforms[0].position + new Vector3(0.0f, -0.1f, 0.0f);
            audioSource.PlayOneShot(audioSource.clip);
        }
    }
コード例 #11
0
ファイル: FistStoreWindow.cs プロジェクト: hickoma/zombounce
        private Windows.FistItemView CreateFistItem(Fist fistModel)
        {
            bool isPurchased = false;

            if (m_PurchasedFists.Contains(fistModel.m_Id))
            {
                isPurchased = true;
            }

            Windows.FistItemView fistItem = Instantiate <Windows.FistItemView>(m_ItemPrefab, m_Content);
            fistItem.Init(fistModel, isPurchased, OnBuyItemClick, OnSelectItemClick);

            // select if needed
            if (fistModel.m_Id == m_SelectedFistName)
            {
                OnSelectItemClick(fistItem);
            }

            return(fistItem);
        }
コード例 #12
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("XButton"))
     {
         //load scene with coffee
         Player.setPowerUpType(1);
         SceneManager.LoadScene("MainGame");
     }
     else if (Input.GetButtonDown("AButton"))
     {
         //load scene with power bar
         Fist.setPunchPower(130);
         Player.setPowerUpType(2);
         SceneManager.LoadScene("MainGame");
     }
     else if (Input.GetButtonDown("BButton"))
     {
         //load scene with hall pass
         Player.setPowerUpType(3);
         SceneManager.LoadScene("MainGame");
     }
 }
コード例 #13
0
ファイル: Fist.cs プロジェクト: rileywhite/Funship
            internal MFist(Fist src, Funf fun)
            {
                switch (src)
                {
                case (var head, Nilf _):
                    this.Head = new Lazy <dynamic>(() =>
                    {
                        var h = call(fun, head);
                        return(h);
                    });
                    this.Tail = new Lazy <Fist>(() => nilf);
                    break;

                case var _:
                    this.Head = new Lazy <dynamic>(() =>
                    {
                        var h = call(fun, src.head);
                        return(h);
                    });
                    this.Tail = new Lazy <Fist>(() => new MFist(src.tail, fun));
                    break;
                }
            }
コード例 #14
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (cont == null)//set controller
        {
            cont = GetComponentInParent <Hand>().controller;
        }
        else
        {
            if (speedImmune > 0)
            {
                speedImmune--;
            }
            if (punchBuffer > 0)
            {
                punchBuffer--;
            }
            if (cont.GetHairTriggerDown())
            {
                punchBuffer = punchWaiter + 1;
            }
            if (cont.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Axis0))
            {
                lFist = null;
                rFist = null;
            }


            if (lFist == null || reSync)
            {
                if (cont == SteamVR_Controller.Input(SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.FarthestLeft)))
                {
                    lFist = this;
                }
                if (cont == SteamVR_Controller.Input(SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.FarthestRight)))
                {
                    rFist = lFist;
                    rFist = this;
                }
            }
            if (rFist == null || reSync)
            {
                if (cont == SteamVR_Controller.Input(SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.FarthestRight)))
                {
                    rFist = this;
                }
                if (cont == SteamVR_Controller.Input(SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.FarthestLeft)))
                {
                    lFist = rFist;
                    lFist = this;
                }
            }
            if (rFist == this)
            {// right fist stuff
                if (speedImmune > 0)
                {
                    speedImmune--;
                }


                if (cont.GetState().rAxis0.x >= .1f || cont.GetState().rAxis0.x <= -.1f)//rotate here
                {
                    rigidScript.Rig3D.transform.Rotate(new Vector3(0, 1, 0), cont.GetState().rAxis0.x * 2f);
                }
                transform.GetChild(0).localScale = new Vector3(-50, -50, 50);//boxing glove scale
            }
            else
            {
                //setup for movement
                Vector3 ovel = rigidScript.Rig3D.velocity;
                Vector3 vel  = rigidScript.Rig3D.velocity;
                Vector2 axis = new Vector3(cont.GetState().rAxis0.x, cont.GetState().rAxis0.y);

                float y = vel.y;
                ovel.y = 0;
                vel.y  = 0;

                if (GroundScript.OnGround)
                {
                    if (axis.sqrMagnitude > .01f)
                    {
                        rigidScript.Rig3D.useGravity = false;
                        if (axis.x < 0)     //left
                        {
                            if (axis.y < 0) //backwards
                            {
                                vel += Vector3.ClampMagnitude(GroundScript.Back.normalized * Mathf.Abs(axis.y) + GroundScript.Left.normalized * Mathf.Abs(axis.x), (GroundScript.OnGround) ? Acceleration : .08f) * axis.magnitude;
                            }
                            else//forwards
                            {
                                vel += Vector3.ClampMagnitude(GroundScript.Forward.normalized * Mathf.Abs(axis.y) + GroundScript.Left.normalized * Mathf.Abs(axis.x), (GroundScript.OnGround) ? Acceleration : .08f) * axis.magnitude;
                            }
                        }
                        else//right
                        {
                            if (axis.y < 0)//backwards
                            {
                                vel += Vector3.ClampMagnitude(GroundScript.Back.normalized * Mathf.Abs(axis.y) + GroundScript.Right.normalized * Mathf.Abs(axis.x), (GroundScript.OnGround) ? Acceleration : .08f) * axis.magnitude;
                            }
                            else//forwards
                            {
                                vel += Vector3.ClampMagnitude(GroundScript.Forward.normalized * Mathf.Abs(axis.y) + GroundScript.Right.normalized * Mathf.Abs(axis.x), (GroundScript.OnGround) ? Acceleration : .08f) * axis.magnitude;
                            }
                        }
                    }
                    else
                    {
                        rigidScript.Rig3D.useGravity = true;
                    }
                }
                else
                {
                    vel += Vector3.ClampMagnitude(Head.lookDir * axis.y + Head.rightDir * axis.x, (GroundScript.OnGround) ? Acceleration : .12f) * axis.magnitude;

                    vel += Vector3.ClampMagnitude(Head.lookDir * axis.y + Head.rightDir * axis.x, (GroundScript.OnGround) ? Acceleration : .12f) * axis.magnitude;
                }
                if (vel.magnitude > MoveSpeed * axis.sqrMagnitude && ovel.magnitude > vel.magnitude)
                {
                    //this is where we move
                    vel.y = y;

                    if (GroundScript.OnGround)
                    {
                        rigidScript.Rig3D.velocity = vel * .9f;//NOW WITH 10 PERCENT TIGHTER TURNS
                    }
                }
                else if (Vector3.Dot(axis, vel) > MoveSpeed)
                {
                    //this is so we dont break velocity cap
                }
                else
                {
                    //this is also a valid move condiditon
                    vel.y = y;

                    rigidScript.Rig3D.velocity = vel;
                }
                transform.GetChild(0).localScale = new Vector3(-50, -50, -50);//fist scale
            }



            if (punchTimer > 0)//this is where we set the fists ideal location to the punch destination
            {
                idealPoint = new Vector3(0, -maxDist / 2, -.065f + maxDist / 2);
                punchTimer--;
                punchWaiter = 20;
            }
            else
            {
                if (punchWaiter > 0)//this is where we wait to punch
                {
                    punchWaiter--;
                    if (transform.localPosition == idealPoint && punchWaiter < 19)
                    {
                        punchWaiter = 0;
                    }
                }
                else if (punchBuffer > 0)//this is where we punch
                {
                    canLaunch  = true;
                    punchTimer = 20;
                    if (whoosh != null)
                    {
                        whoosh.pitch = Random.Range(0.8f, 1.2f); // randomizes pitch
                        whoosh.Play();                           // plays whoosh sound when punch
                    }
                }
                idealPoint = new Vector3(0, 0, -.065f);
            }



            transform.localPosition = transform.localPosition + Vector3.ClampMagnitude(idealPoint - transform.localPosition, maxSpeed);

            if (cont.GetPress(Valve.VR.EVRButtonId.k_EButton_Grip) && Physics.Raycast(transform.position - (transform.forward - transform.up).normalized * .1f, transform.forward - transform.up, maxDist))
            {
                for (int i = 0; i < transform.childCount; i++)
                {
                    if (transform.GetChild(i).CompareTag("Projection"))
                    {
                        transform.GetChild(i).gameObject.SetActive(true);
                    }
                }
            }
            else
            {
                for (int i = 0; i < transform.childCount; i++)
                {
                    if (transform.GetChild(i).CompareTag("Projection"))
                    {
                        transform.GetChild(i).gameObject.SetActive(false);
                    }
                }
            }
            if (cont.GetAxis(Valve.VR.EVRButtonId.k_EButton_Axis1).x > .01 && Physics.Raycast(transform.position - (transform.forward - transform.up).normalized * .1f, transform.forward - transform.up, out info, .4f))
            {
                if (info.transform.tag == "playButton")
                {
                    Scene currentScene = SceneManager.GetActiveScene();
                    SceneManager.LoadScene((currentScene.buildIndex + 1) % SceneManager.sceneCountInBuildSettings);
                }
                if (info.transform.tag == "Enemy")
                {
                    Destroy(info.transform.gameObject);
                }
                if (info.transform.tag == "Missile")
                {
                    Destroy(info.transform.gameObject);
                }
                if (info.transform.tag != "Boost" && info.transform.tag != "enemy" && info.transform.name != "Player" && canLaunch)
                {
                    canLaunch = false;
                    cont.TriggerHapticPulse(3000, Valve.VR.EVRButtonId.k_EButton_Axis4);
                    Vector3 vel = rigidScript.Rig3D.velocity;
                    vel.y = 0;
                    if ((vel + ((transform.forward - transform.up).normalized * -.3f / Time.deltaTime * .55f)).magnitude < vel.magnitude)
                    {
                        vel += ((transform.forward - transform.up).normalized * -.3f / Time.deltaTime * .55f) * 2;
                    }
                    else
                    {
                        vel += ((transform.forward - transform.up).normalized * -.3f / Time.deltaTime * .55f);
                    }

                    punchTimer = 0;
                    rigidScript.Rig3D.velocity = vel;
                    if (info.collider.gameObject.tag == "Pillar")
                    {
                        rigidScript.Rig3D.AddForce(((transform.forward - transform.up).normalized * -.3f / Time.deltaTime * 800f * 2));
                    }

                    if (punch != null)
                    {
                        punch.pitch = Random.Range(0.8f, 1.2f);
                        punch.Play();
                    }
                }
            }
        }
        if (speedImmune > 0)
        {
            rigidScript.Rig3D.velocity = Vector3.ClampMagnitude(rigidScript.Rig3D.velocity, 25 * speedImmune * speedImmune);
        }
        else
        {
            rigidScript.Rig3D.velocity = Vector3.ClampMagnitude(rigidScript.Rig3D.velocity, 25);
        }

        prevLocalPos = transform.localPosition;
        prevpos      = transform.position;

        ////////////Wind Sounds///////////
        if (wind != null)
        {
            if (GroundScript.OnGround)
            {
                wind.volume -= 0.5f * Time.deltaTime; // fade out
            }

            else if (rigidScript.Rig3D.velocity.magnitude != 0)
            {
                wind.volume = (rigidScript.Rig3D.velocity.magnitude / 25); // wind volume depends on velocity
            }


            else
            {
                wind.volume -= 0.2f * Time.deltaTime; // fade out
            }
        }
        /////////Footstep Sounds/////////
        if (foot1 != null)
        {
            int num = Random.Range(1, 3);
            if (GroundScript.OnGround && rigidScript.Rig3D.velocity.magnitude > 1.0f && rigidScript.Rig3D.velocity.magnitude < 5.0f && timeForSteps > 50.0f) // walking speed
            {
                foot1.pitch = Random.Range(0.8f, 1.2f);
                foot1.Play();
                timeForSteps = 0;
            }

            else if (GroundScript.OnGround && rigidScript.Rig3D.velocity.magnitude >= 5.0f && timeForSteps > 25.0f) // running speed
            {
                foot1.pitch = Random.Range(0.8f, 1.2f);
                foot1.Play();
                timeForSteps = 0;
            }
            timeForSteps++;
        }
        //////////Landing Sound///////////
        if (wind != null)
        {
            if (GroundScript.OnGround == false)
            {
                wasInAir = true;
            }

            if (GroundScript.OnGround == true && wasInAir == true)
            {
                landing.Play();
                wasInAir = false;
            }
        }
    }
コード例 #15
0
ファイル: Fist.cs プロジェクト: rileywhite/Funship
 public void Deconstruct(out dynamic head, out Fist tail)
 {
     head = nilf;
     tail = nilf;
 }
コード例 #16
0
ファイル: Fist.cs プロジェクト: rileywhite/Funship
 public void Deconstruct(out dynamic head, out Fist tail)
 {
     head = this.head;
     tail = this.tail;
 }
コード例 #17
0
ファイル: Fist.cs プロジェクト: rileywhite/Funship
 public FistEnumerator(Fist list)
 {
     // the nullable logic is here because MoveNext is called before the first value is read
     this.InitialList = list;
     this.List        = default;
 }
コード例 #18
0
ファイル: Fist.cs プロジェクト: rileywhite/Funship
 public void Deconstruct(out dynamic head, out Fist tail)
 {
     head = this.Head.Value;
     tail = this.Tail.Value;
 }
コード例 #19
0
 public override void Added()
 {
     base.Added();
     fists[0] = new Fist(true, Parent as Player);
     fists[1] = new Fist(false, Parent as Player);
 }
コード例 #20
0
ファイル: Fist.cs プロジェクト: rileywhite/Funship
 public static Fist create(Fist source, Funf predicate) => drop_until(source, predicate) switch
 {
コード例 #21
0
ファイル: Program.cs プロジェクト: tkbcode/RockPaperScissors
        static void Main(string[] args)
        {
            Fist           MyFist   = new Fist();
            Fist           YourFist = new Fist();
            ConsoleKeyInfo Keypress;
            int            GameCount = 1, WinCount = 0, LossCount = 0, TieCount = 0;

            Console.WriteLine("ROCK, PAPER, SCISSORS");
            Console.WriteLine("=====================");
            do
            {
                Console.WriteLine("Press R to throw Rock, P for Paper, S for Scissors, ");
                Console.WriteLine("and any other key to throw randomly.  ");
                Console.WriteLine("Press Escape to exit the program.");

                Keypress = Console.ReadKey(true);
                MyFist.Throw();

                switch (Keypress.Key)
                {
                case ConsoleKey.R:
                    YourFist.SetState(FistType.rock);
                    break;

                case ConsoleKey.P:
                    YourFist.SetState(FistType.paper);
                    break;

                case ConsoleKey.S:
                    YourFist.SetState(FistType.scissors);
                    break;

                default:
                    YourFist.Throw();
                    break;
                }

                Console.WriteLine();
                Console.WriteLine("Game " + GameCount++);
                Console.WriteLine("Your fist threw " + YourFist.ToString());
                Console.WriteLine("My fist threw " + MyFist.ToString());

                if (MyFist > YourFist)
                {
                    Console.WriteLine("I win!");
                    WinCount++;
                }
                else if (MyFist < YourFist)
                {
                    Console.WriteLine("You win!");
                    LossCount++;
                }
                else
                {
                    Console.WriteLine("It's a tie!");
                    TieCount++;
                }
                Console.WriteLine("Wins: {0}, Losses:  {1}, Ties:  {2}", LossCount, WinCount, TieCount);
                Console.WriteLine();
            } while (Keypress.Key != ConsoleKey.Escape);
        }
コード例 #22
0
ファイル: WalkingGesture.cs プロジェクト: lulitd/LEAP3DJAM
 void Start()
 {
     _controller = new Controller ();
     fist = GameObject.FindObjectOfType<Fist> ();
 }