optimize gear and energy
This commit is contained in:
parent
7f10c06a0a
commit
e4ba3f9907
@ -3,11 +3,11 @@ using System;
|
||||
|
||||
public class Energy : Area2D
|
||||
{
|
||||
Event eventBus;
|
||||
private Event _eventBus;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
eventBus = GetNode<Event>("/root/Event");
|
||||
_eventBus = GetNode<Event>("/root/Event");
|
||||
GetNode<AnimatedSprite>("AnimatedSprite").Play();
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ public class Energy : Area2D
|
||||
SetCollisionLayerBit((int) Game.PhysicsLayer.Collectable, false);
|
||||
if (String.Equals(body.Name, "Player"))
|
||||
{
|
||||
eventBus.EmitSignal("EnergyCollected", 1);
|
||||
_eventBus.EmitSignal("EnergyCollected", 1);
|
||||
}
|
||||
QueueFree();
|
||||
}
|
||||
|
@ -2,9 +2,15 @@ using Godot;
|
||||
|
||||
public class Gear : Area2D
|
||||
{
|
||||
private Sprite _sprite;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_sprite = GetNode<Sprite>("Sprite");
|
||||
}
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
Sprite sprite = GetNode<Sprite>("Sprite");
|
||||
sprite.Rotate(Mathf.Deg2Rad(2));
|
||||
_sprite.Rotate(Mathf.Deg2Rad(2));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user