Esempio n. 1
0
        public static bool CastMark(Obj_AI_Hero target)
        {
            if (Config.GetBool("调试"))
            {
                DeBug.Debug("[释放技能]", $"目标 {target.Name.ToUTF8()}", DebugLevel.Warning, Output.ChatBox);
                DeBug.Debug("[释放技能]", $"模式 {Config.GetStringList("预判模式").SelectedValue}", DebugLevel.Warning, Output.ChatBox);
                DeBug.Debug("[释放技能]", $"命中率 {Config.GetStringList("命中率").SelectedValue}", DebugLevel.Warning, Output.ChatBox);
            }



            var hitChangceIndex = Config.GetStringIndex("命中率");
            var PredictMode     = Config.GetStringIndex("预判模式");


            if (PredictMode == 0)
            {
                var hitChangceList = new[] { HitChance.VeryHigh, HitChance.High, HitChance.Medium };
                return(SnowBall.CastIfHitchanceEquals(target, hitChangceList[hitChangceIndex]));
            }
            else if (PredictMode == 1)
            {
                var hitChangceList = new[] { SebbyPredict.HitChance.VeryHigh, SebbyPredict.HitChance.High, SebbyPredict.HitChance.Medium };
                return(CastSpell(SnowBall, target, hitChangceList[hitChangceIndex]));
            }
            return(false);
        }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     Sno = FindObjectOfType <SnowBall>();
     //Sno = this.gameObject.GetComponent<SnowBall>();
     StartCoroutine(rang());
     stat = FindObjectOfType <NG_StatManager>();
 }
Esempio n. 3
0
 float GetAngle(SnowBall snowBall)
 {
     return(Vector2.Angle(
                Helper.RemoveY(transform.forward),
                Helper.RemoveY(snowBall.transform.position - transform.position)
                ));
 }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        Me     = this.gameObject;
        Parent = this.gameObject.GetComponent <SnowBall>();
        SM     = FindObjectOfType <SoundManager>();

        minExplosionScale = Me.transform.localScale;
    }
Esempio n. 5
0
    void OnPushStop(InputAction.CallbackContext context)
    {
        snowBall = null;

        ResetArms();

        //material.SetColor(BaseColor, defaultColor);
    }
Esempio n. 6
0
    void Throw()
    {
        pickedUpSnowBall.EnableCollider();
        pickedUpSnowBall.transform.parent = snowBallParent;
        pickedUpSnowBall.Throw((throwForce / pickedUpSnowBall.radius) * (transform.forward + Vector3.up));
        pickedUpSnowBall = null;

        ResetArms();
    }
    private void OnDragStart()
    {
        _snowBallClone  = Instantiate(_playerItem, _itemPosition.position, Quaternion.identity);
        _snowBallScript = _snowBallClone.GetComponent <SnowBall>();
        _snowBallScript.DeactivateRb();

        _startPoint = _cam.ScreenToViewportPoint(Input.mousePosition);

        trajectory.Show();
    }
Esempio n. 8
0
    void OnPushStart(InputAction.CallbackContext context)
    {
        if (pickedUpSnowBall)
        {
            return;
        }

        snowBall = interacter.GetSnowBall();

        //material.SetColor(BaseColor, Color.red);
    }
Esempio n. 9
0
 private void Awake()
 {
     if (sb_instance == null)
     {
         sb_instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Esempio n. 10
0
    void Shoot()
    {
        // Create the new projectile a bit in front of the spaceship and store the reference to the new gameobject.
        // the Instatiate function creates a new GameObject copy (clone) from a Prefab at a specific location and orientation.

        GameObject snowballObject = Instantiate(snowballPrefab, transform.position + new Vector3(dir, 0, 0), Quaternion.identity) as GameObject;
        // Get access to the script on the new snowbball using GetComponent to modify it.
        SnowBall snowball = snowballObject.GetComponent <SnowBall> ();

        snowball.direction.x = dir;
    }
Esempio n. 11
0
    void OnTriggerEnter(Collider other)
    {
        SnowBall snowBall = other.GetComponent <SnowBall>();

        if (!snowBall)
        {
            return;
        }

        //snowBall.GetComponent<Renderer>().material.SetColor("_BaseColor", Color.cyan);

        snowBalls.Add(snowBall);
    }
Esempio n. 12
0
    void OnTriggerExit(Collider other)
    {
        SnowBall snowBall = other.GetComponent <SnowBall>();

        if (!snowBall)
        {
            return;
        }

        //snowBall.GetComponent<Renderer>().material.SetColor("_BaseColor", Color.white);

        snowBalls.Remove(snowBall);
    }
Esempio n. 13
0
    void Pickup()
    {
        pickedUpSnowBall = snowBall ? snowBall : interacter.GetSnowBall();
        snowBall         = null;

        if (!pickedUpSnowBall)
        {
            return;
        }

        pickedUpSnowBall.DisableCollider();
        pickedUpSnowBall.transform.parent   = transform;
        pickedUpSnowBall.transform.position = transform.position + (1f + pickedUpSnowBall.radius) * Vector3.up;
        interacter.Remove(pickedUpSnowBall);

        ArmsUpward();
    }
Esempio n. 14
0
 private static SnowBallState GetSnowBallState()
 {
     if (!SnowBall.IsReady())
     {
         return(SnowBallState.Cooldown);
     }
     else
     {
         if ("summonersnowball" == SnowBall.Instance.Name.ToLower() ||
             "summonerporothrow" == SnowBall.Instance.Name.ToLower())
         {
             return(SnowBallState.Mark);
         }
         else
         {
             return(SnowBallState.Dash);
         }
     }
 }
Esempio n. 15
0
    private void Shoot(Vector2 TargetDirection)
    {
        Debug.Log(Trigger + " " + _PlayerState);
        if (Trigger == 1 && _PlayerState == PlayerState.Moving)
        {
            if (shootForce < maxShootForce)
            {
                shootForce += offsetIncreaseShootForce;
            }
            _PlayerState = PlayerState.LoadingShoot;
        }
        else if (Trigger == 0 && _PlayerState == PlayerState.LoadingShoot && TargetDirection.x != 0 && TargetDirection.y != 0)
        {
            GameObject SnowBall;
            switch (FireMode)
            {
            case 0:
                SnowBall = Instantiate <GameObject>(snowBallBigShootPrefab, transform.position, transform.rotation);
                SnowBall.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(TargetDirection.y, TargetDirection.x) * Mathf.Rad2Deg);
                SnowBall.GetComponent <Rigidbody2D>().AddForce(TargetDirection * shootForce);
                break;

            case 1:
                SnowBall = Instantiate <GameObject>(snowBallMultiShootPrefab, transform.position, transform.rotation);
                SnowBall.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(TargetDirection.y, TargetDirection.x) * Mathf.Rad2Deg);
                foreach (Rigidbody2D multishoot in SnowBall.GetComponentsInChildren <Rigidbody2D>())
                {
                    multishoot.AddForce(TargetDirection * shootForce);
                }
                break;

            case 2:
                SnowBall = Instantiate <GameObject>(snowBallPiercingShootPrefab, transform.position, transform.rotation);
                SnowBall.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(TargetDirection.y, TargetDirection.x) * Mathf.Rad2Deg);
                SnowBall.GetComponent <Rigidbody2D>().AddForce(TargetDirection * shootForce);
                break;
            }
            GetComponent <Scale>().DecreaseByShoot(FireMode);
            shootForce   = defaultShootForce;
            _PlayerState = PlayerState.Moving;
        }
    }
Esempio n. 16
0
    //Get the ball closer to be in front of the player
    public SnowBall GetSnowBall()
    {
        if (snowBalls.Count == 0)
        {
            return(null);
        }

        SnowBall snowBall = snowBalls[0];
        float    angle    = GetAngle(snowBall);

        foreach (SnowBall ball in snowBalls)
        {
            if (GetAngle(ball) < angle)
            {
                snowBall = ball;
            }
        }

        return(snowBall);
    }
Esempio n. 17
0
    void OnCrush(InputAction.CallbackContext context)
    {
        if (pickedUpSnowBall)
        {
            return;
        }

        if (!snowBall)
        {
            snowBall = interacter.GetSnowBall();
        }

        if (!snowBall)
        {
            return;
        }

        interacter.Remove(snowBall);
        snowBall.Crush();
        snowBall = null;
    }
Esempio n. 18
0
    // Update is called once per frame
    void Update()
    {
        if (!m_Frozen)
        {
            float horizontal = Input.GetAxis("Horizontal" + m_PlayerID);

            m_Rigidbody.velocity  = Vector3.down * 10f;
            m_Rigidbody.velocity += Vector2.right * horizontal * m_Speed;

            Debug.Log(horizontal);

            if (horizontal != 0)
            {
                switch ((int)Mathf.Sign(horizontal))
                {
                case -1:
                    m_Direciton = Direction.Left;
                    UpdateSprite();
                    break;

                case 1:
                    m_Direciton = Direction.Right;
                    UpdateSprite();
                    break;
                }
            }

            if (m_CanJump && !m_Jump)
            {
                if (Input.GetButtonDown("Vertical" + m_PlayerID))
                {
                    m_Jump = true;
                    transform.position.Set(transform.position.x, transform.position.y + 0.50f, transform.position.z);
                    //m_JumpPosition = (transform.position) + Vector3.up * 5f;
                    //m_JumpStart = transform.position;
                    m_CanJump = false;
                    StartCoroutine(Jump());
                }
            }

            //if (m_Jump)
            //{
            //    if (m_JumpTimer < 0.35f)
            //    {
            //        m_JumpTimer += Time.deltaTime;
            //        transform.position += new Vector3(0, 30f * Time.deltaTime);
            //        //m_Jump = !RoofCheck();
            //    }
            //    else if (m_JumpTimer >= 0.35f) { m_JumpTimer = 0f; m_Jump = false; }
            //    //m_JumpPosition = m_JumpPosition + new Vector2(horizontal,0);
            //    //transform.position = Vector3.Lerp(transform.position, m_JumpPosition, m_JumpCurve.Evaluate(m_JumpTimer));
            //}

            if (!m_Jump)
            {
                m_CanJump = GroundCheck();
            }


            if (Input.GetButtonDown("Use" + m_PlayerID))
            {
                if (m_CanJump)
                {
                    m_Inventory.AddSnowball();
                }
            }

            if (Input.GetButtonDown("Fire" + m_PlayerID))
            {
                if (m_Inventory.Amount > 0)
                {
                    SnowBall snowball = m_SnowBalls.Get().GetComponent <SnowBall>();
                    if (m_Direciton == Direction.Left)
                    {
                        snowball.Setup(m_LeftShooting.position, Direction.Left, m_SnowBalls);
                    }
                    if (m_Direciton == Direction.Right)
                    {
                        snowball.Setup(m_RightShooting.position, Direction.Right, m_SnowBalls);
                    }

                    if (OnSnowballThrow != null)
                    {
                        OnSnowballThrow(m_PlayerID);
                    }
                }
            }
        }
    }
Esempio n. 19
0
 public void Remove(SnowBall snowBall)
 {
     snowBalls.Remove(snowBall);
 }
Esempio n. 20
0
    void RecycleBall(SnowBall _ball)
    {
        Table.RecycleRes(_ball);

        --mTotalBallCount;

        BallTable.Remove (_ball.gameObject);
    }