Skip to content

Instantly share code, notes, and snippets.

@daleth90

daleth90/Game.cs Secret

Created Jul 26, 2017
Embed
What would you like to do?
shooting example
using UnityEngine;
using Zenject;
public class Game : ITickable {
private readonly Hero hero;
private readonly Armony armony;
public Game( Hero hero, Armony armony ) {
this.hero = hero;
this.armony = armony;
}
public void Tick() {
hero.Move( new Vector2( Input.GetAxis( "Horizontal" ), Input.GetAxis( "Vertical" ) ) );
armony.CooldownCurrentWeapon( Time.deltaTime );
if ( Input.GetButton( "Fire1" ) ) {
Transform muzzle = hero.GetMuzzle();
armony.FireCurrentWeapon( muzzle.position, muzzle.up );
}
if ( Input.GetButtonDown( "SwitchRight" ) ) {
armony.SwitchRight();
}
if ( Input.GetButtonDown( "SwitchLeft" ) ) {
armony.SwitchLeft();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment