initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// meta-description: Classic movement for gravity games (platformer, ...)
|
||||
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
public const float Speed = 300.0f;
|
||||
public const float JumpVelocity = -400.0f;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Vector2 velocity = Velocity;
|
||||
|
||||
// Add the gravity.
|
||||
if (!IsOnFloor())
|
||||
{
|
||||
velocity += GetGravity() * (float)delta;
|
||||
}
|
||||
|
||||
// Handle Jump.
|
||||
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
|
||||
{
|
||||
velocity.Y = JumpVelocity;
|
||||
}
|
||||
|
||||
// Get the input direction and handle the movement/deceleration.
|
||||
// As good practice, you should replace UI actions with custom gameplay actions.
|
||||
Vector2 direction = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
|
||||
if (direction != Vector2.Zero)
|
||||
{
|
||||
velocity.X = direction.X * Speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
|
||||
}
|
||||
|
||||
Velocity = velocity;
|
||||
MoveAndSlide();
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
// meta-description: Classic movement for gravity games (FPS, TPS, ...)
|
||||
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
public const float Speed = 5.0f;
|
||||
public const float JumpVelocity = 4.5f;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Vector3 velocity = Velocity;
|
||||
|
||||
// Add the gravity.
|
||||
if (!IsOnFloor())
|
||||
{
|
||||
velocity += GetGravity() * (float)delta;
|
||||
}
|
||||
|
||||
// Handle Jump.
|
||||
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
|
||||
{
|
||||
velocity.Y = JumpVelocity;
|
||||
}
|
||||
|
||||
// Get the input direction and handle the movement/deceleration.
|
||||
// As good practice, you should replace UI actions with custom gameplay actions.
|
||||
Vector2 inputDir = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
|
||||
Vector3 direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
|
||||
if (direction != Vector3.Zero)
|
||||
{
|
||||
velocity.X = direction.X * Speed;
|
||||
velocity.Z = direction.Z * Speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
|
||||
velocity.Z = Mathf.MoveToward(Velocity.Z, 0, Speed);
|
||||
}
|
||||
|
||||
Velocity = velocity;
|
||||
MoveAndSlide();
|
||||
}
|
||||
}
|
20
modules/mono/editor/script_templates/EditorPlugin/plugin.cs
Normal file
20
modules/mono/editor/script_templates/EditorPlugin/plugin.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
// meta-description: Basic plugin template
|
||||
|
||||
#if TOOLS
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
public override void _EnterTree()
|
||||
{
|
||||
// Initialization of the plugin goes here.
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
// Clean-up of the plugin goes here.
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,16 @@
|
||||
// meta-description: Basic import script template
|
||||
|
||||
#if TOOLS
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
public override GodotObject _PostImport(Node scene)
|
||||
{
|
||||
// Modify the contents of the scene upon import.
|
||||
return scene; // Return the modified root node when you're done.
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,15 @@
|
||||
// meta-description: Basic import script template (no comments)
|
||||
|
||||
#if TOOLS
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
public override GodotObject _PostImport(Node scene)
|
||||
{
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,15 @@
|
||||
// meta-description: Basic editor script template
|
||||
|
||||
#if TOOLS
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
// Called when the script is executed (using File -> Run in Script Editor).
|
||||
public override void _Run()
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
17
modules/mono/editor/script_templates/Node/default.cs
Normal file
17
modules/mono/editor/script_templates/Node/default.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
// meta-description: Base template for Node with default Godot cycle methods
|
||||
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
}
|
||||
}
|
8
modules/mono/editor/script_templates/Object/empty.cs
Normal file
8
modules/mono/editor/script_templates/Object/empty.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
// meta-description: Empty template suitable for all Objects
|
||||
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
public partial class _CLASS_ : _BASE_
|
||||
{
|
||||
}
|
8
modules/mono/editor/script_templates/SCsub
Normal file
8
modules/mono/editor/script_templates/SCsub
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
|
||||
import editor.template_builders as build_template_cs
|
||||
|
||||
env.CommandNoCache("templates.gen.h", Glob("*/*.cs"), env.Run(build_template_cs.make_templates))
|
@@ -0,0 +1,64 @@
|
||||
// meta-description: Visual shader's node plugin template
|
||||
|
||||
using _BINDINGS_NAMESPACE_;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class VisualShaderNode_CLASS_ : _BASE_
|
||||
{
|
||||
public override string _GetName()
|
||||
{
|
||||
return "_CLASS_";
|
||||
}
|
||||
|
||||
public override string _GetCategory()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public override string _GetDescription()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public override VisualShaderNode.PortType _GetReturnIconType()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override int _GetInputPortCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override string _GetInputPortName(int port)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public override VisualShaderNode.PortType _GetInputPortType(int port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override int _GetOutputPortCount()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public override string _GetOutputPortName(int port)
|
||||
{
|
||||
return "result";
|
||||
}
|
||||
|
||||
public override VisualShaderNode.PortType _GetOutputPortType(int port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override string _GetCode(Godot.Collections.Array<string> inputVars, Godot.Collections.Array<string> outputVars, Shader.Mode mode, VisualShader.Type type)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user