void Start() { graceFrames = maxGraceFrames; sprite = transform.Find("AtlasSprite"); spriteController = sprite.GetComponent <atlasSpriteController>(); anim = GetComponentInChildren <Animator>(); deformer = GetComponentInChildren <Deformer>(); controller = GetComponent <characterController>(); particleMaker = GetComponent <particleMaker>(); boxCollider = GetComponent <BoxCollider2D>(); steps = GetComponentInChildren <stepSounds>(); hanger = transform.Find("AtlasSprite/Hanger"); colliderStartSize = boxCollider.size; colliderStartOffset = boxCollider.offset; sortingOrder = sprite.GetComponent <SpriteRenderer>().sortingOrder; gravity = gameManager.Instance.gravity; //-(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; float djgravity = -(2 * doubleJumpHeight) / Mathf.Pow(timeToJumpApex, 2); doubleJumpVelocity = Mathf.Abs(djgravity) * timeToDoubleJumpApex; setLastSafePosition(); warpToCurrentDoor(); if (created) { Destroy(gameObject); } created = true; DontDestroyOnLoad(gameObject); }
// Start is called before the first frame update void Start() { target = FindObjectOfType <characterController>(); offset = transform.position - target.transform.position; targetPos = target.transform.position; targetPos.y = target.transform.position.y; }
// Update is called once per frame void Update() { if (_player == null) { _player = FindObjectOfType <characterController>(); } }
void Start() { if (player == null) { player = GameObject.Find("character").GetComponent <characterController>(); } gamePlayController = GameObject.Find("GameplayController").GetComponent <gamePlayController>(); }
// Start is called before the first frame update void Start() { thePlayer = (characterController)FindObjectOfType(typeof(characterController)); fowardPoint = GameObject.Find("FowardPoint").transform; backPoint = GameObject.Find("BackPoint").transform; highPoint = GameObject.Find("HighPoint").transform; lowPoint = GameObject.Find("LowPoint").transform; }
// Start is called before the first frame update void Start() { cC = GameObject.Find("Player").GetComponent <characterController>(); if (whileTamingFunction[0] == null) { whileTamingFunction[0] = new UnityEvent(); } }
private void OnTriggerEnter(Collider trigger) { characterController player = trigger.gameObject.GetComponent <characterController>(); if (trigger.gameObject.tag == "player" && player.active == true) { lm.pickLevel(); gameObject.GetComponent <BoxCollider>().enabled = false; } }
// Start is called before the first frame update void Start() { lowestPoint = GameObject.Find("LowestPoint").transform; endPoint = GameObject.Find("EndPoint").transform; thePlayer = (characterController)FindObjectOfType(typeof(characterController)); playerHealth = GameObject.Find("healthbar").GetComponent <RectTransform>(); healthScale = playerHealth.sizeDelta.x; endLevel = GameObject.Find("EndLevel").transform; playerHealthCount = thePlayer.health; // Debug.Log(SceneManager.GetSceneByBuildIndex(SceneManager.GetActiveScene().buildIndex).IsValid()); }
public PlayerData(characterController character) { cHealth = character.HP.getCurrentHPValue; cStam = character.stam.getCurrentStamValue; cMana = character.MP.getCurrentMPValue; position = new float[3]; position[0] = character.transform.position.x; position[1] = character.transform.position.y; position[2] = character.transform.position.z; }
public void setupWorld() { firstWorld = new world(); firstWorld.setupWorld(this.worldWidth, this.worldHeight); tileController = GameObject.FindGameObjectWithTag("tileSpriteController").GetComponent <tileSpriteController>(); charController = GameObject.FindGameObjectWithTag("characterController").GetComponent <characterController>(); WOcontroller = GameObject.FindGameObjectWithTag("WOspriteController").GetComponent <WOspriteController>(); generateWorld(); Debug.Log("World is setup"); }
// Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); myRideAnchor = transform.Find("Model Parent/RideAnchor"); GOD = GameObject.Find("GOD").GetComponent <godScript>(); cC = GameObject.Find("Player").GetComponent <characterController>(); nav = GetComponent <NavMeshAgent>(); hFS = GetComponent <horseFunctionsScript>(); if (hFS == null) { hFS = new horseFunctionsScript(); } changePosition(); }
public static void SavePlayer(characterController character) { BinaryFormatter formatter = new BinaryFormatter(); string path = Path.Combine(Application.persistentDataPath + "/player.dat"); FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(character); stream.Position = 0; formatter.Serialize(stream, data); stream.Close(); Debug.Log("saving"); }
void Start() { currentHealth = fullHealth; controlMovement = GetComponent <characterController>(); //HUD inicjalizacja healthSlider.maxValue = fullHealth; healthSlider.value = fullHealth; damaged = false; playerAS = GetComponent <AudioSource>(); }
LayerMask layerMask; //플레이어만 감지하는 레이어마스크 protected void init(string _name, int _hp, float _speed, int _damage, float _range, float _atkspeed) { rigid = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); player = FindObjectOfType <characterController>(); layerMask = 1 << 8; monsterName = _name; mosnterHp = _hp; moveSpeed = _speed; attackDamage = _damage; attackRange = _range; attackSpeed = _atkspeed; }
// Start is called before the first frame update void Start() { health = GetComponent <healthController>(); anim = GetComponentInChildren <Animator>(); controller = GetComponent <characterController>(); deformer = GetComponentInChildren <Deformer>(); facing = (int)transform.localScale.x; setFacing(); gravity = gameManager.Instance.gravity; maxFallVel = gameManager.Instance.maxFallVel; state = State.Movement; act = (readyToPounce) ? 0 : actionCoolDown; }
// Start is called before the first frame update void Start() { cc = GetComponent <characterController>(); hc = GetComponent <healthController>(); anim = GetComponentInChildren <Animator>(); deformer = GetComponentInChildren <Deformer>(); while (startDir == 0) { startDir = Random.Range(-1, 1); } velocity = Vector3.right * startDir; }
void FixedUpdate() { _players = gamePlayController.players; if (_players.Count != 0) { //player = _players[_players.FindIndex(item => item != null)]; player = _players[gamePlayController.currentCharIndex]; //playerX = player.charTransform.position.x; playerY = player.charTransform.position.y; selfTransform.position = new Vector3(Mathf.Lerp(selfTransform.position.x, gamePlayController.rightPoint, lerpSpeed), Mathf.Lerp(selfTransform.position.y, playerY, lerpSpeed), Mathf.Lerp(selfTransform.position.z, -10 - (0.7f * gamePlayController.players.Count), lerpSpeed)); } }
IEnumerator blockOutToPlayer(GameObject obj) { characterController character = obj.GetComponent <characterController> (); float maxspeed = character.maxSpeed; character.maxSpeed = 0; yield return(new WaitForSeconds(.3f)); character.maxSpeed = maxspeed / 4; yield return(new WaitForSeconds(.5f)); character.maxSpeed = maxspeed / 2; yield return(new WaitForSeconds(.9f)); character.maxSpeed = maxspeed; }
// Start is called before the first frame update protected virtual void Start() { anim = GetComponentInChildren <Animator>(); controller = GetComponent <characterController>(); deformer = GetComponentInChildren <Deformer>(); boxCollider = GetComponent <BoxCollider2D>(); healthCtrl = GetComponent <healthController>(); sprite = transform.Find("sprite"); gravity = gameManager.Instance.gravity; maxFallVel = gameManager.Instance.maxFallVel; state = new StateMachine("Movement"); state.addStates("Hurt", "Wait", "Attack"); intangibleStates = state.findStates("Hurt", "Wait"); state.setState("Movement"); }
void Update() { if (thisPlayer != null) // Prevents errors in lobby { psScript = thisPlayer.GetComponent <PlayerShoot>(); pScript = thisPlayer.GetComponent <Player>(); cScript = thisPlayer.GetComponent <characterController>(); currentHealth = pScript.getHealth; if (psScript.form == "AR") { ammo.text = (" Ammo: " + psScript.ammoAR + " / " + psScript.maxAmmoAR); // Display ammo when in attack form } if (psScript.form == "Tank") { ammo.text = ("Ammo: " + psScript.ammoTank + " / " + psScript.maxAmmoTank); // Display ammo when in heavy form } if (psScript.form == "Utility") { ammo.text = (" Ammo: " + "∞"); // Display ammo when in melee form } healthBar.fillAmount = currentHealth / 100; // Healthbar speedBar.fillAmount = cScript.speed / 12.5f; // Speedbar kills.text = "Kills: " + cScript.kills; deaths.text = "Deaths: " + cScript.deaths; grenades.text = psScript.grenades + "/" + "2"; // Display amount of grenades if (currentHealth <= 0) { StartCoroutine(Die()); } if (currentHealth > 0) { BlackScreen.enabled = false; respawn.text = ""; respawnTimer = 3; } } }
// Use this for initialization void Start() { player = FindObjectOfType <characterController>(); if (textFile != null) { textLines = (textFile.text.Split('\n')); } if (endAtLine == 0) { endAtLine = textLines.Length - 1; } if (isActive) { EnableTextBox(); } else { DisableTextBox(); } }
// Start is called before the first frame update void Start() { cC = GameObject.Find("Player").GetComponent <characterController>(); rb = myHips.GetComponent <Rigidbody>(); }
private void Awake() { playerTarget = FindObjectOfType <characterController>(); }
private void Awake() { targetPlayer = FindObjectOfType <characterController>(); magneticField = FindObjectOfType <MagneticCont>(); }
// Start is called before the first frame update void Start() { cC = GetComponent <characterController>(); }
public void SetCharacterController(GameObject obj) { _cc = obj.GetComponent <characterController>(); }
// Start is called before the first frame update void Start() { ControllerScript = GetComponent <characterController>(); }
private void Awake() { Target = FindObjectOfType <characterController>(); enemy = FindObjectOfType <EnemyHealthBar>(); }
// Start is called before the first frame update void Start() { character = FindObjectOfType <characterController>(); LoadPlayer(); }
// Start is called before the first frame update void Start() { velocity = Vector2.zero; controller = GetComponent <characterController>(); }