Skip to content

Instantly share code, notes, and snippets.

@tetya
tetya / CameraMovement_Mouse.cs
Created March 7, 2016 09:27
マウスによるカメラ操作
using UnityEngine;
using System.Collections;
public class CameraMovement_Mouse : MonoBehaviour {
public Transform target; //<! Playerを中心に回転するのに使用
public float speedY = 60f;
public float maxAngle = 45f;
private float anglePerSec = 360f; //<! 角速度(オイラー)
private float hitDir = 0f;
@tetya
tetya / CameraFollowing.cs
Created March 7, 2016 14:08
カメラの追従
using UnityEngine;
using System.Collections;
public class CameraFollowing : MonoBehaviour {
public Transform target;
public float distance = 1f;
private Vector3 tarPosXZ;//<! ワールド空間
private Vector3 camPosXZ;//<! ワールド空間
private Vector3 direction;//<! ワールド空間
@tetya
tetya / PlayerMovement.cs
Created March 7, 2016 23:29
プレイヤーの移動
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
[SerializeField]
private float speed =3.5f;
private Rigidbody playerRig;
private Vector3 movement;//<! 移動先の座標(Updateで更新する)
using UnityEngine;
using System.Collections;
public class CharacterChanger : MonoBehaviour {
public Avatar [] avatars = new Avatar[3];
public GameObject [] characters = new GameObject[3];
private int index = 0;
private Animator playerAnimator;
using UnityEngine;
using System.Collections;
public class EnemyMovement : MonoBehaviour {
public float slowSpeed;
public Transform player;
private NavMeshAgent nav;
private Animator animator;
private int currentPath=0;
@tetya
tetya / BulletBehaviour.cs
Created March 8, 2016 13:05
弾丸の振る舞い
using UnityEngine;
using System.Collections;
public class BulletBehaviour : MonoBehaviour {
public float speed = 20f;
public float time_Destroy = 2f;
private Rigidbody bulRig;
private string shooterTag;
private LifeManager lifeManager;
using UnityEngine;
using System.Collections;
public class EnemyAttack : MonoBehaviour {
public float range_punch = 1f;
public float range_shooting = 10f;
public float interval = 3f;
public AudioSource soundPunch;
public AudioSource soundShoot;
using UnityEngine;
using System.Collections;
public class PunchBehaviour : MonoBehaviour {
public float time_Destroy = 0.5f;
public LifeManager lifeManager;//このオブジェクトはHierarchyに常に存在するので直接参照可能
public GameObject attacker;
private string attackerTag;
using UnityEngine;
using System.Collections;
public class CoinBehaviour : MonoBehaviour {
public ParticleSystem parSys;
public int score = 10;//<! コインによる獲得スコア
private SpawnManager spawn; //<! SpawnManagerで設定
private string [] objectNames = {"SunnySD","LunaSD","StarSD"};//<! Hierarchy上のオブジェクト名を変更の際は注意
private int gettableIndex = 0;//<! コインを入手できるキャラクターのindex。objectNamesに対応。
using UnityEngine;
using System.Collections;
public class CoinBehaviour : ItemBehaviour {
public ParticleSystem parSys;
public int score = 10;//<! コインによる獲得スコア
private GameObject [] characters = new GameObject[3];
private int gettableIndex = 0;//<! コインを入手できるキャラクターのindex。objectNamesに対応。
private ScoreManager scoreManager;