コード例 #1
0
 // Use this for initialization
 void Initialise()
 {
     m_Health = Health;
     UserAxis = new Movement_Axis();
     UserAxis.SetXY(0, 0);
     m_Speed_X = Speed_X;
     m_Speed_Y = Speed_Y;
 }
コード例 #2
0
    public void Move(Movement_Axis Direction)
    {
        // Movement has been done in this way so that the Player and the enemies can use the same movement scripts and mechanics.
        // Can be fed manual input or a programmed sequence
        Vector3 Position = transform.position;

        Position.x += (Speed_X + Time.deltaTime) * UserAxis.GetX();
        Position.y += (Speed_Y + Time.deltaTime) * UserAxis.GetY();
        Position.z  = transform.position.z;

        transform.position = Position;
    }
コード例 #3
0
    void Start()
    {
        axis        = new Movement_Axis();
        axis.roll   = 0f;
        axis.pitch  = 0f;
        axis.yaw    = 0f;
        axis.thrust = 10f;

        rb = GetComponent <Rigidbody>();

        gm  = GameObject.FindWithTag("GameController").GetComponent <GameManager>();
        cam = Camera.main.gameObject;
        ui  = GameObject.FindWithTag("UI").GetComponent <UIManager>();
    }