void Start() { //get the stuff you need arm = transform.parent.GetComponent <ArmScript>(); hand = GetComponent <Image>(); audio = GetComponent <AudioSource>(); }
IEnumerator ChargedShot(float startForce, float endForce) { float elapsed = 0; float duration = 1.5f; Vector3 scaleVector; while (elapsed < duration && Input.GetButton("Fire2")) { throwingForce = Mathf.SmoothStep(startForce, endForce, elapsed); scale = Mathf.SmoothStep(1, maxScale, elapsed); scaleVector = new Vector3(aimingArm.localScale.x, scale, aimingArm.localScale.z); aimingArm.transform.localScale = scaleVector; elapsed = Mathf.Min(duration, elapsed + Time.deltaTime); yield return(new WaitForEndOfFrame()); } aimingArm.localScale = Vector3.one; projectileAmount -= 1; armClone = Instantiate((ArmScript)armToInstantiate, transform.position, transform.rotation); scaleVector = new Vector3(armClone.transform.localScale.z, scale, armClone.transform.localScale.z); armClone.transform.localScale = scaleVector; armClone.myRb.AddForce(transform.up * throwingForce, ForceMode2D.Impulse); armState = ArmState.ArmDetached; player.WhatArmIsActive(arms, false); }
private void OnLoadScriptCommand() { if (Commands.Count > 0) { MessageBoxResult messageBoxResult = MessageBox.Show( "You will lose current script.\nAre you sure you want to continue?", "Arm controller", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (messageBoxResult != MessageBoxResult.Yes) { return; } } OpenFileDialog dialogue = new OpenFileDialog(); dialogue.DefaultExt = ".xml"; dialogue.Filter = "XML Files (*.xml)|*.xml"; bool?result = dialogue.ShowDialog(); if (result == true) { ArmScript script = ArmScript.ReadArmScript(dialogue.FileName); Commands.Clear(); script.Movements.ForEach((command) => Commands.Add(command)); } }
// Use this for initialization new void Start() { base.Start(); arm = transform.GetChild(0).GetComponent <ArmScript>(); ui = GameObject.FindGameObjectWithTag("UIcontroller").GetComponent <UIScript>(); StartCoroutine(CheckCold()); cntCoal = 0; }
public async Task ExecuteScriptAsync(ArmScript script) { foreach (var command in script.Movements) { await ExecuteCommandAsync(command); } return; }
void Start() { arm = GetComponent <ArmScript>(); minAimAngle = 90 - angleRange / 2; maxAimAngle = 90 + angleRange / 2; minBlockAngle = 90 - blockAngleRange / 2; maxBlockAngle = 90 + blockAngleRange / 2; SetAimAngle(Vector2.right); }
private void OnSaveScriptCommand() { SaveFileDialog dialogue = new SaveFileDialog(); dialogue.Filter = "XML Files (*.xml)|*.xml"; dialogue.Title = "save script"; bool?result = dialogue.ShowDialog(); if (result == true) { ArmScript.SaveArmScript(dialogue.FileName, new ArmScript(Commands)); } }
// Use this for initialization void Start() { // Get the weapons weaponOne = GameObject.FindGameObjectWithTag("FrontalCannon").GetComponent <ShooterScript>(); cuerpoBoss = GameObject.FindGameObjectWithTag("FrontalCannon") as GameObject; anim = gameObject.GetComponent <Animator>(); canShoot = true; arm = this.transform.GetChild(1).GetComponent <ArmScript>(); armTwo = this.transform.GetChild(2).GetComponent <ArmScript>(); //misileLauncher = this.transform.GetChild(4).GetComponent<MisileScript>(); instance.isMoving = true; _startPosition = transform.position; health = this.gameObject.GetComponent <EnemyHealth>(); pickUp = true; weaponTimeToShoot = Time.time + weaponShootingRate; clawTimeToShoot = Time.time + clawShootingRate; misileTimeToShoot = Time.time + misileShootingRate; }
/// <summary> /// Присвоить arm /// </summary> /// <param name="arm"></param> public void SetArm(ArmScript arm) { this.arm = arm; }
private void LoadScriptFromFile(string path) { Script = ArmScript.ReadArmScript(path); }