7-28-25 @ 11:39pm
This commit is contained in:
145
Gameplay/Ball.cs
145
Gameplay/Ball.cs
@@ -1,13 +1,15 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
public partial class Ball : RigidBody2D
|
||||
{
|
||||
public bool _placed = false, _potted = false, _available = false, _hovered = false, _selected = false, _aimed = false, _moving = false, _isCue = false;
|
||||
public int _defense, _defenseMax;
|
||||
[Signal]
|
||||
public delegate void OnHitEventHandler();
|
||||
public bool _active = false, _placed = false, _potted = false, _available = false, _hovered = false, _selected = false, _aimed = false, _launched = false, _moving = false, _isCue = false;
|
||||
public float _moveThreshold = 5.0f;
|
||||
|
||||
public Vector2 _newPosition = new Vector2(-1, -1);
|
||||
|
||||
|
||||
public static Ball _Create()
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/ball.tscn");
|
||||
@@ -15,7 +17,14 @@ public partial class Ball : RigidBody2D
|
||||
|
||||
return newBall;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
{
|
||||
if (LinearVelocity.Length() > 0 && LinearVelocity.Length() < _moveThreshold)
|
||||
@@ -24,6 +33,10 @@ public partial class Ball : RigidBody2D
|
||||
if (_moving)
|
||||
{
|
||||
_moving = false;
|
||||
if (_launched)
|
||||
{
|
||||
_launched = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (LinearVelocity.Length() >= _moveThreshold)
|
||||
@@ -33,7 +46,7 @@ public partial class Ball : RigidBody2D
|
||||
_moving = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Globals.Instance._anyMovement)
|
||||
{
|
||||
if (_available)
|
||||
@@ -47,23 +60,125 @@ public partial class Ball : RigidBody2D
|
||||
{
|
||||
_available = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Place(Vector2 POSITION)
|
||||
|
||||
public void Pot()
|
||||
{
|
||||
_placed = true;
|
||||
Position = POSITION;
|
||||
_placed = false;
|
||||
_potted = true;
|
||||
Sleeping = true;
|
||||
_moving = false;
|
||||
}
|
||||
|
||||
|
||||
public void SetSprite(string PATH)
|
||||
{
|
||||
GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>(PATH);
|
||||
}
|
||||
|
||||
private void OnBodyEntered(Node2D TARGET)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnMouseEntered()
|
||||
{
|
||||
_hovered = true;
|
||||
if (_active)
|
||||
{
|
||||
_hovered = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnMouseExited()
|
||||
{
|
||||
_hovered = false;
|
||||
if (_active)
|
||||
{
|
||||
_hovered = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Processes
|
||||
public virtual void ProcessOnAdd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnBattleStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnBattleEnd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnCollision()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnCreation()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnCritical()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnDeath()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnDefend()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnExpiration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnLaunch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnMovement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnRemove()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnSell()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnStop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnTurnEnd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessOnTurnStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user