2019.01

目录:

1.正弦曲线:

private float get_Sin_Z_Value(float x)
{
   float ZQ;  //周期
   float inner = (2 * (float)Mathf.PI) / ZQ; //角速度
   float ya = (float)Mathf.Sin(inner * x);
   float maall = swing_len * 0.5f;  //swing_len是振幅
   float middle = maall - swing_len / 2;
   return (middle + maall * ya);
 }

2.DOTween  插值渐变

   DOTween学习

3.untiy 对手柄的适配

  unity对手柄的适配

4. 获取每一个按键的名称

using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;

public class PlayerJoystickClass : MonoBehaviour {
    private string currentButton;//当前按下的按键
    // Use this for initialization
    void Start () {
		
	}

    string[] names = {"LL", "LR", "RL", "RR", "DX", "DY", "HX", "HY"};
	
	// Update is called once per frame
	void Update () {
        var values = Enum.GetValues(typeof(KeyCode));//存储所有的按键
        for (int x = 0; x < values.Length; x++)
        {
            if (Input.GetKeyDown((KeyCode)values.GetValue(x)))
            {
                currentButton = values.GetValue(x).ToString();//遍历并获取当前按下的按键
            }
        }

        /*for (int i = 0; i < names.Length; i ++)
        {
            if(Input.GetAxis(names[i]) > 0 && Input.GetAxis(names[i]) < 1)
            {
                currentButton = (names[i] + "正向");
            }
            if (Input.GetAxis(names[i]) < 0 && Input.GetAxis(names[i]) > -1)
            {
                currentButton = (names[i] + "负向");
            }
        }*/
    }

    void OnGUI()
    {
        GUI.TextArea(new Rect(0, 0, 250, 40), "Current Button : " + currentButton);//使用GUI在屏幕上面实时打印当前按下的按键
    }


}

5. 设置坐标

  transform代表世界坐标,unity中显示的是局部坐标。 

  处理方式有两种:

  a.将物体移动根目录层获得其坐标。

  b.使用其父物体的世界坐标来进行设置。

6. 动画操作

  坐标由于需要适配不同的分辨率,所以最好使用DOLocal..相关的函数操作。

  public AnimationCurve anim_curve的变量用于动画曲线的设置。

7. buff系统

  缠绕了两个周的工作,投入的时间很多,但是效果不是很明显,不过教训是挺多的,确实也是第一次完整的写一个这么大的系统了,找个时间专门写一下来为以后做忠告了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值