Feel  5.1
The best way to improve your game's feel and make it extra juicy
MoreMountains.Feel.Snake Class Reference

A class used to handle Feel's Snake demo's snake "head", the part controlled by the player More...

Inheritance diagram for MoreMountains.Feel.Snake:

Public Member Functions

virtual void Turn ()
 Called when turning, rotates the snake's head, changes its direction, plays a feedback More...
 
virtual void Teleport ()
 Called by the snake head's MMViewportEdgeTeleporter, defines what happens when the snake is teleported to the other side of the screen More...
 
virtual void Eat ()
 Called when eating food, triggers visual effects, increases points, plays a feedback More...
 
virtual void EatEffect ()
 When eating food, we instantiate a new body part unless we've reached our limit More...
 
virtual void Lose (SnakeBodyPart part)
 When we lose a body part, we play a feedback, destroy the last part, lose points, and update our points display More...
 

Public Attributes

float Speed = 5f
 the snake's movement speed More...
 
float NormalSpeedMultiplier = 1f
 the speed multiplier to apply at most times More...
 
float SpeedChangeRate = 0.2f
 the rate at which speed should vary More...
 
Vector3 Direction = Vector2.right
 the current direction of the snake More...
 
float BoostMultiplier = 2f
 the speed multiplier to apply to the speed when boosting More...
 
float BoostDuration = 2f
 the duration of the boost, in seconds More...
 
SnakeBodyPart BodyPartPrefab
 the prefab to use for body parts More...
 
int BodyPartsOffset = 7
 the offset to apply between two parts More...
 
int MaxAmountOfBodyParts = 10
 the maximum amount of body parts for this snake More...
 
float MinTimeBetweenLostParts = 2f
 the minimum duration, in seconds, between 2 allowed parts losses More...
 
MMFeedbacks TurnFeedback
 a feedback to play when the snake turns More...
 
MMFeedbacks TeleportFeedback
 a feedback to play when the snake teleports to the other side of the screen More...
 
MMFeedbacks TeleportOnceFeedback
 a feedback to play when teleporting once More...
 
MMFeedbacks EatFeedback
 a feedback to play when eating snake food More...
 
MMFeedbacks LoseFeedback
 a feedback to play when losing a body part More...
 
int SnakePoints = 0
 
float _speed
 
float _speedMultiplier
 
float _lastFoodEatenAt = -100f
 
List< SnakeBodyPart_snakeBodyParts
 

Protected Member Functions

void Awake ()
 On Awake, we initialize our snake's points, speed, position recorder, and body parts container More...
 
virtual void Update ()
 Every frame, we check for input and move our snake's head More...
 
virtual void HandleInput ()
 Every frame, looks for turn input More...
 
virtual void HandleMovement ()
 Every frame, moves the snake's head's position More...
 
virtual IEnumerator TeleportCo ()
 A coroutine used to teleport the snake to the other side of the screen More...
 
virtual IEnumerator EatCo ()
 A coroutine used to go through every snake body part and trigger its Eat MMFeedbacks More...
 

Protected Attributes

Vector3 _newPosition
 
MMPositionRecorder _recorder
 
float _lastLostPart = 0f
 

Detailed Description

A class used to handle Feel's Snake demo's snake "head", the part controlled by the player

Member Function Documentation

◆ Awake()

void MoreMountains.Feel.Snake.Awake ( )
protected

On Awake, we initialize our snake's points, speed, position recorder, and body parts container

◆ Eat()

virtual void MoreMountains.Feel.Snake.Eat ( )
virtual

Called when eating food, triggers visual effects, increases points, plays a feedback

◆ EatCo()

virtual IEnumerator MoreMountains.Feel.Snake.EatCo ( )
protectedvirtual

A coroutine used to go through every snake body part and trigger its Eat MMFeedbacks

◆ EatEffect()

virtual void MoreMountains.Feel.Snake.EatEffect ( )
virtual

When eating food, we instantiate a new body part unless we've reached our limit

◆ HandleInput()

virtual void MoreMountains.Feel.Snake.HandleInput ( )
protectedvirtual

Every frame, looks for turn input

◆ HandleMovement()

virtual void MoreMountains.Feel.Snake.HandleMovement ( )
protectedvirtual

Every frame, moves the snake's head's position

◆ Lose()

virtual void MoreMountains.Feel.Snake.Lose ( SnakeBodyPart  part)
virtual

When we lose a body part, we play a feedback, destroy the last part, lose points, and update our points display

Parameters
part

◆ Teleport()

virtual void MoreMountains.Feel.Snake.Teleport ( )
virtual

Called by the snake head's MMViewportEdgeTeleporter, defines what happens when the snake is teleported to the other side of the screen

◆ TeleportCo()

virtual IEnumerator MoreMountains.Feel.Snake.TeleportCo ( )
protectedvirtual

A coroutine used to teleport the snake to the other side of the screen

Returns

◆ Turn()

virtual void MoreMountains.Feel.Snake.Turn ( )
virtual

Called when turning, rotates the snake's head, changes its direction, plays a feedback

◆ Update()

virtual void MoreMountains.Feel.Snake.Update ( )
protectedvirtual

Every frame, we check for input and move our snake's head

Member Data Documentation

◆ _lastFoodEatenAt

float MoreMountains.Feel.Snake._lastFoodEatenAt = -100f

◆ _lastLostPart

float MoreMountains.Feel.Snake._lastLostPart = 0f
protected

◆ _newPosition

Vector3 MoreMountains.Feel.Snake._newPosition
protected

◆ _recorder

MMPositionRecorder MoreMountains.Feel.Snake._recorder
protected

◆ _snakeBodyParts

List<SnakeBodyPart> MoreMountains.Feel.Snake._snakeBodyParts

◆ _speed

float MoreMountains.Feel.Snake._speed

◆ _speedMultiplier

float MoreMountains.Feel.Snake._speedMultiplier

◆ BodyPartPrefab

SnakeBodyPart MoreMountains.Feel.Snake.BodyPartPrefab

the prefab to use for body parts

◆ BodyPartsOffset

int MoreMountains.Feel.Snake.BodyPartsOffset = 7

the offset to apply between two parts

◆ BoostDuration

float MoreMountains.Feel.Snake.BoostDuration = 2f

the duration of the boost, in seconds

◆ BoostMultiplier

float MoreMountains.Feel.Snake.BoostMultiplier = 2f

the speed multiplier to apply to the speed when boosting

◆ Direction

Vector3 MoreMountains.Feel.Snake.Direction = Vector2.right

the current direction of the snake

◆ EatFeedback

MMFeedbacks MoreMountains.Feel.Snake.EatFeedback

a feedback to play when eating snake food

◆ LoseFeedback

MMFeedbacks MoreMountains.Feel.Snake.LoseFeedback

a feedback to play when losing a body part

◆ MaxAmountOfBodyParts

int MoreMountains.Feel.Snake.MaxAmountOfBodyParts = 10

the maximum amount of body parts for this snake

◆ MinTimeBetweenLostParts

float MoreMountains.Feel.Snake.MinTimeBetweenLostParts = 2f

the minimum duration, in seconds, between 2 allowed parts losses

◆ NormalSpeedMultiplier

float MoreMountains.Feel.Snake.NormalSpeedMultiplier = 1f

the speed multiplier to apply at most times

◆ SnakePoints

int MoreMountains.Feel.Snake.SnakePoints = 0

◆ Speed

float MoreMountains.Feel.Snake.Speed = 5f

the snake's movement speed

◆ SpeedChangeRate

float MoreMountains.Feel.Snake.SpeedChangeRate = 0.2f

the rate at which speed should vary

◆ TeleportFeedback

MMFeedbacks MoreMountains.Feel.Snake.TeleportFeedback

a feedback to play when the snake teleports to the other side of the screen

◆ TeleportOnceFeedback

MMFeedbacks MoreMountains.Feel.Snake.TeleportOnceFeedback

a feedback to play when teleporting once

◆ TurnFeedback

MMFeedbacks MoreMountains.Feel.Snake.TurnFeedback

a feedback to play when the snake turns


The documentation for this class was generated from the following file: