protected void Start() { NinjaState = CharacterState.Idle; ParameterIDs.Add("Running", Animator.StringToHash("Running")); ParameterIDs.Add("Falling", Animator.StringToHash("Falling")); ParameterIDs.Add("Jumping", Animator.StringToHash("Jumping")); ParameterIDs.Add("Kicking", Animator.StringToHash("Kicking")); ParameterIDs.Add("PunchAttackState", Animator.StringToHash("PunchAttackState")); BoxCollider2DFix.AddBoxColliderFix("Idle", new ColliderFixInfo(new Vector2(1, 1.705f), new Vector2(0, -0.016f))); BoxCollider2DFix.AddBoxColliderFix("Jumping", new ColliderFixInfo(new Vector2(1, 1.316f), new Vector2(-0.1f, -0.021f))); BoxCollider2DFix.AddBoxColliderFix("Falling", new ColliderFixInfo(new Vector2(1.084f, 1.521f), new Vector2(-0.206f, 0.099f))); BoxCollider2DFix.AddBoxColliderFix("Running", new ColliderFixInfo(new Vector2(1, 1.664f), new Vector2(0, -0.193f))); Attack = new Attack(); TimerFramesOfAttacks = new Dictionary <string, TimerFramesOfAttack> { { "Kick", new TimerFramesOfAttack(1, new[] { new FrameOfAttack( o => { Vector2 positionOffset = new Vector2((o.transform.rotation.y > 0 ? 1 : -1) * 30, 0.5f); AttackFunctions.SimplePhysicalAttack( new FrameDataPhysical( new Vector2(o.transform.rotation.y > 0 ? 1 : -1, 0), positionOffset, Prefabs[0], radius: 0.5f, framesOfLife: 10, setKnockBack: true, damage: 0.05f, multiplier: 3))(o); return(true); }) }, 25) }, { "Punch 1", new TimerFramesOfAttack(1, new[] { new FrameOfAttack( o => { Vector2 positionOffset = new Vector2((o.transform.rotation.y > 0 ? 1 : -1) * 32, 1.24f); AttackFunctions.SimplePhysicalAttack( new FrameDataPhysical( new Vector2(o.transform.rotation.y > 0 ? 1 : -1, 0), positionOffset, Prefabs[0], radius: 0.51f, framesOfLife: 10, damage: 0.01f, multiplier: 0f))(o); return(true); }) }, 10) }, { "Punch 2", new TimerFramesOfAttack(1, new[] { new FrameOfAttack( o => { Vector2 positionOffset = new Vector2((o.transform.rotation.y > 0 ? 1 : -1) * 32, 1.24f); AttackFunctions.SimplePhysicalAttack( new FrameDataPhysical( new Vector2(o.transform.rotation.y > 0 ? 1 : -1, 0), positionOffset, Prefabs[0], radius: 0.51f, framesOfLife: 10, damage: 0.01f, multiplier: 0f))(o); return(true); }) }, 10) }, { "Punch 3", new TimerFramesOfAttack(1, new[] { new FrameOfAttack( o => { Vector2 positionOffset = new Vector2((o.transform.rotation.y > 0 ? 1 : -1) * 30, 1); AttackFunctions.SimplePhysicalAttack( new FrameDataPhysical( new Vector2(0, 1), positionOffset, Prefabs[0], radius: 0.5f, framesOfLife: 10, damage: 0.2f, multiplier: 20, setKnockBack: true))(o); return(true); }) }, 20) } }; }
void Start() { Attack = new Attack(); TimerFramesOfAttacks = new Dictionary <string, TimerFramesOfAttack> { { "A", new TimerFramesOfAttack(60, new [] { new FrameOfAttack( o => { Vector2 positionOffset = new Vector2(-0.5f, 1); AttackFunctions.SimplePhysicalAttack( new FrameDataPhysical( Utils.Degree2Vec2(o.transform.rotation.z), positionOffset, Prefabs[0]))(o); Vector3 spawnPosition = o.transform.position + Utils.Vec22Vec3( Utils.NormalizedVectorFromAngle( o.transform.eulerAngles.z + 105f)); Instantiate(Prefabs[2], spawnPosition, o.transform.rotation ); return(true); }), }) }, { "X", new TimerFramesOfAttack(120, new [] { new FrameOfAttack( o => { o.GetComponent <Rigidbody2D>().velocity = Utils.NormalizedVectorFromAngle( o.transform.eulerAngles.z + 90f) * 40f; return(true); }), }) }, { "LT", new TimerFramesOfAttack(120, new[] { new FrameOfAttack(o => { MouseCharacter mouseCharacter = o.GetComponent <MouseCharacter>(); float angleOfAttack = o.transform.eulerAngles.z + 90f; Vector2 vectorizedAngleOfAttack = Utils.NormalizedVectorFromAngle(angleOfAttack); Vector2 vectorizedAngleOfAttackOffset = Utils.NormalizedVectorFromAngle(angleOfAttack + 15f); Vector2 spawnPosition = o.transform.position + Utils.Vec22Vec3(vectorizedAngleOfAttackOffset) * 1.0f; GameObject projectileThrown = Instantiate( mouseCharacter.Prefabs[1], spawnPosition, o.transform.rotation); Projectile projectile = projectileThrown.GetComponent <Projectile>(); projectile.Damage = 0.1f; projectile.Direction = vectorizedAngleOfAttack; projectile.Velocity = vectorizedAngleOfAttack; projectile.Multiplier = 0.5f; projectile.FramesOfLife = 100; projectile.Source = o; return(true); }) }) } }; }