java金融项目案例

阅读: 评论:0

java金融项目案例

java金融项目案例

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class player1 : MonoBehaviour {

private float m_nextFire;

///

/// 开火速率

///

public float FireRate = 2.0f;

///

/// 子弹对象

///

public GameObject Bullet;

///

/// 子弹速度

///

public float BulletSpeed;

void FixedUpdate()

{

m_nextFire = m_nextFire + Time.fixedDeltaTime;

if(Input.GetMouseButton(0) && m_nextFire>FireRate)

{

// 获取鼠标坐标并转换成世界坐标

Vector3 m_mousePosition = usePosition;

m_mousePosition = Camera.main.ScreenToWorldPoint(m_mousePosition);

// 因为是2D,用不到z轴。使将z轴的值为0,这样鼠标的坐标就在(x,y)平面上了

m_mousePosition.z = 0;

// 子弹角度

float m_fireAngle = Vector2.Angle(m_mousePosition - ansform.position, Vector2.up);

if(m_mousePosition.x&ansform.position.x)

{

m_fireAngle = -m_fireAngle;

}

// 计时器归零

m_nextFire = 0;

// 生成子弹

GameObject m_bullet = Instantiate(Bullet, transform.position, Quaternion.identity) as GameObject;

// 速度

m_bullet.GetComponent().velocity = ((m_mousePosition-transform.position).normalized * BulletSpeed);

// 角度

ansform.eulerAngles = new Vector3(0, 0, m_fireAngle);

}

}

}

本文发布于:2024-02-04 12:33:17,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170707331255609.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:案例   金融   项目   java
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23