コード例 #1
0
ファイル: KappaAI.cs プロジェクト: smiotix/Sample
    private async UniTask Guner()
    {
        //Debug.Log(Command.ToString() +" "+ MoveF + " " + PT.gameObject.name);
        if (!Rb.freezeRotation)
        {
            Rb.freezeRotation = true;
        }
        if (FLAGS[0])
        {
            Command = Com.Move;
            if (!WaterGun.activeSelf)
            {
                WaterGun.SetActive(true);
            }

            WG = WaterGun.GetComponent <WaterGun>();
            if (WG != null)
            {
                WG.Body  = this.gameObject;
                FLAGS[0] = false;
            }
        }
        if (Command == Com.Move)
        {
            StartCoroutine(MoveF);
        }
        else if (Command == Com.Attack)
        {
            await GunShoot();
        }
        else if (Command == Com.Idle)
        {
            await Idle01();
        }
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: jaimuepe/Dog-Care-Center
    private void Start()
    {
        currentWeaponIdx = 0;

        for (int i = 0; i < weapons.Length; i++)
        {
            if (i == 0)
            {
                weapons[i].gameObject.SetActive(true);
            }
            else
            {
                weapons[i].gameObject.SetActive(false);
            }
            if (weapons[i].GetType() == typeof(WaterGun))
            {
                waterGun = weapons[i] as WaterGun;
            }
            else
            {
                treatGun = weapons[i] as TreatGun;
            }
        }

        grenadesUI = FindObjectOfType <GrenadesUI>();
        grenadesUI.Initialize(grenadeSystem.magazine.maxAmmo);
        UpdateWeaponUI();
    }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     waterGun               = waterGunGO.GetComponent <WaterGun>();
     ghostHunter            = ghostHunterGO.GetComponent <GhostHunter>();
     currentWeaponText.text = "Current Weapon: Water Gun 2.0";
     currentAmmoText.text   = "Ammo: " + waterGun.GetComponent <WaterGun>().ammo;
     defaultColor           = currentAmmoText.color;
     reloadColor            = new Vector4(1f, 0.2f, 0.2f, 1f);
 }
コード例 #4
0
    private void Start()
    {
        scriptWaterGun = GameObject.Find("WaterGun").GetComponent <WaterGun>();

        /*if (scriptWaterGun == null)
         * {
         *  scriptWaterGun = GameObject.Find("WaterGun").GetComponent<WaterGun>();
         *  print("StartscriptWaterGun Nulo");
         * }*/
    }
コード例 #5
0
    private void Start()
    {
        spriteRend    = GetComponent <SpriteRenderer>();
        defaultSprite = spriteRend.sprite;

        sprayR = GetComponent <Rigidbody2D>();

        wgScript = GameObject.Find("WaterGun").GetComponent <WaterGun>();

        StartCoroutine(FlashMuzzleFlash());
    }
コード例 #6
0
 private void Update()
 {
     if (scriptWaterGun == null)
     {
         scriptWaterGun = GameObject.Find("WaterGun").GetComponent <WaterGun>();
         //print("scriptWaterGun Nulo");
     }
     r_realValue  = scriptWaterGun.realValue;
     r_maxValue   = scriptWaterGun.maxValue;
     r_waterBar   = scriptWaterGun.waterBar;
     r_waterCount = scriptWaterGun.waterCount;
 }
コード例 #7
0
 void Awake()
 {
     //comando para o script pegar o Transform, Rigidbody2D e Animator do personagem
     heroT       = GetComponent <Transform>();
     heroR       = GetComponent <Rigidbody2D>();
     anim        = GetComponent <Animator>();
     sprite      = GetComponent <SpriteRenderer>();
     gunPoint    = transform.Find("GunPoint");
     wgSprite    = GameObject.Find("WaterGun").GetComponent <SpriteRenderer>();
     wgScript    = GameObject.Find("WaterGun").GetComponent <WaterGun>();
     healthIcon  = GameObject.Find("HealthIcon").GetComponent <Image>();
     healthCount = GameObject.Find("HealthCount").GetComponent <Text>();
     check       = GameObject.Find("BottomCheck").GetComponent <Transform>();
 }
コード例 #8
0
    // Update is called once per frame
    void Update()
    {
        sk2.cdTimer -= Time.deltaTime;
        if (playerScript.baseHp > 0 && Input.GetKeyDown(KeyCode.Alpha1))
        {
            sk1.use();
        }

        if (Input.GetKeyUp(KeyCode.Alpha1))
        {
            wsk1.skillActive = false;
        }
        if (playerScript.baseHp > 0 && Input.GetKeyDown(KeyCode.Alpha2))
        {
            sk2.use();
        }
        if (wsk1.skillActive)
        {
            playerScript.minusMp(wsk1.mpCost * Time.deltaTime);
            if (playerScript.mp <= 0)
            {
                wsk1.skillActive = false;
                if (wsk1.wg != null)
                {
                    wsk1.skillActive = false;
                }
            }
        }
        if (!wsk1.skillActive)
        {
            if (wsk1.wg != null)
            {
                WaterGun wgScript = wsk1.wg.GetComponent <WaterGun>();
                if (wgScript.audioSource.isPlaying)
                {
                    wgScript.audioSource.Stop();
                }
                wsk1.wg.GetComponent <ParticleEmitter>().emit = false;
            }
        }
        if (wsk1.wg != null)
        {
            Vector3 rotVector = playerScript.transform.eulerAngles;
            rotVector.x += 90;
            wsk1.wg.transform.position    = playerScript.transform.position + (playerScript.transformObject.TransformDirection(Vector3.forward) * 0.5f) + new Vector3(0, 1.8f, 0);
            wsk1.wg.transform.eulerAngles = rotVector;
            wsk1.wg.transform.Find("particle effect").GetComponent <ParticleEmitter>().emit = wsk1.skillActive;
        }
    }
コード例 #9
0
 public override void use()
 {
     //MonoBehaviour.print(cdTimer);
     if (playerScript.mp >= mpCost / 5)
     {
         skillActive = true;
         wg.GetComponent <ParticleEmitter>().emit = true;
         WaterGun wgScript = wg.GetComponent <WaterGun>();
         wgScript.damageRate = damageRate;
         if (!wgScript.audioSource.isPlaying)
         {
             wgScript.audioSource.Play();
         }
     }
 }
コード例 #10
0
    private void Start()
    {
        bulletTransform = GetComponent <Transform>();
        Vector3 scala = bulletTransform.localScale;

        scala.x *= -1;
        bulletTransform.localScale = scala;

        spriteRend    = GetComponent <SpriteRenderer>();
        defaultSprite = spriteRend.sprite;

        sprayR = GetComponent <Rigidbody2D>();

        wgScript = GameObject.Find("WaterGun").GetComponent <WaterGun>();

        StartCoroutine(FlashMuzzleFlash());
    }
コード例 #11
0
ファイル: KappaAI.cs プロジェクト: smiotix/Sample
    private async UniTask GunShoot()
    {
        if (WG != null)
        {
            if (Anim.GetBool("is_run"))
            {
                Rb.isKinematic = true;
                Rb.isKinematic = false;
            }
            if (FLAGS[1])
            {
                MoveTimer = -1;
                Anim.Play("Gun");
                await WG.Trigger();

                MoveTimer = 15f;
                FLAGS[1]  = false;
            }
            if (MoveTimer < 0.0f)
            {
                await WG.Off();

                Anim.Play("Idle");
                FLAGS[1] = true;
                Command  = Com.Move;
            }
            else
            {
                transform.LookAt(new Vector3(PT.position.x, Rb.position.y, PT.position.z));
            }

            MoveTimer -= 0.1f * 60 * Time.deltaTime;
        }
        else
        {
            WG = WaterGun.GetComponent <WaterGun>();
        }
    }
コード例 #12
0
 private void Start()
 {
     movement = GetComponent <Movement>();
     waterGun = GetComponentInChildren <WaterGun>();
 }
コード例 #13
0
ファイル: Tutorial.cs プロジェクト: programsimbah/cucimomo
    void SwitchTutorialState()
    {
        switch (tutorialState)
        {
        case "clean_leaves":
            if (GameObject.Find("TutPosStart_clean_leaves") != null)
            {
                startPos = GameObject.Find("TutPosStart_clean_leaves").transform.position;
                LeafBlower lb = GameObject.Find("Tools/LeafBlower").GetComponent <LeafBlower>();
                if (lb.bLeaves1)
                {
                    endPos = lb.psLeaves1.transform.position;
                }
                else if (lb.bLeaves2)
                {
                    endPos = lb.psLeaves2.transform.position;
                }
                else if (lb.bLeaves3)
                {
                    endPos = lb.psLeaves3.transform.position;
                }
                else if (lb.bLeaves4)
                {
                    endPos = lb.psLeaves4.transform.position;
                }
                else if (lb.bLeaves5)
                {
                    endPos = lb.psLeaves5.transform.position;
                }
                StartPointing();
                StartCoroutine("MovePoinnter");
            }
            break;

        case "cut_branches":
            if (GameObject.Find("TutPosStart_cut_branches") != null)
            {
                startPos = GameObject.Find("TutPosStart_cut_branches").transform.position;
                Shears sh = GameObject.Find("Tools/Shears").GetComponent <Shears>();

                string[] branchNames = sh.BranchesToCut.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                if (branchNames.Length > 0)
                {
                    int ind = Mathf.FloorToInt(Random.Range(0, branchNames.Length));
                    if (GameObject.Find(branchNames[ind]) != null)
                    {
                        endPos = GameObject.Find(branchNames[ind]).transform.position;
                        StartPointing();
                        StartCoroutine("MovePoinnter");
                    }
                }
            }
            break;

        case "clean_dirt":
            if (GameObject.Find("TutPosStart_clean_dirt") != null)
            {
                startPos = GameObject.Find("TutPosStart_clean_dirt").transform.position;
                WaterHose wh = GameObject.Find("Tools2/WaterHose/Nozzle").GetComponent <WaterHose>();

                string[] names = wh.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                if (names.Length > 0)
                {
                    int ind = Mathf.FloorToInt(Random.Range(0, names.Length));
                    if (GameObject.Find(names[ind]) != null)
                    {
                        endPos             = GameObject.Find(names[ind]).transform.position;
                        transform.position = startPos;
                        StartPointing();
                        StartCoroutine("MovePoinnter");
                    }
                }
            }
            break;


        case "clean_stains":
            if (GameObject.Find("TutPosStart_clean_stains") != null)
            {
                startPos = GameObject.Find("TutPosStart_clean_stains").transform.position;
                WaterGun wg = GameObject.Find("Tools2/Compressor/WaterGun").GetComponent <WaterGun>();

                string[] names = wg.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                if (names.Length > 0)
                {
                    int ind = Mathf.FloorToInt(Random.Range(0, names.Length));
                    if (GameObject.Find(names[ind]) != null)
                    {
                        endPos             = GameObject.Find(names[ind]).transform.position + new Vector3(.5f, -.5f, 0);
                        transform.position = startPos;
                        StartPointing();
                        StartCoroutine("MovePoinnter");
                    }
                }
            }
            break;


        case "wheel_brush":
            if (GameObject.Find("TutPosStart_wheel_brush") != null)
            {
                startPos = GameObject.Find("TutPosStart_wheel_brush").transform.position;
                WheelBrush wb = GameObject.Find("Tools/WheelBrush").GetComponent <WheelBrush>();

                string[] names = wb.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                if (names.Length > 0)
                {
                    int ind = Mathf.FloorToInt(Random.Range(0, names.Length));
                    if (GameObject.Find(names[ind]) != null)
                    {
                        endPos             = GameObject.Find(names[ind]).transform.position + new Vector3(.5f, -.5f, 0);
                        transform.position = startPos;
                        StartPointing();
                        StartCoroutine("MovePoinnter");
                    }
                }
            }
            break;

        case "bubbles":
            if (GameObject.Find("TutPosStart_bubbles") != null)
            {
                startPos = GameObject.Find("TutPosStart_bubbles").transform.position;
                StartCoroutine("MovePoinnter_Bubbles");
            }
            break;

        case "wax_car":
            if (GameObject.Find("TutPosStart_wax_car") != null)
            {
                startPos = GameObject.Find("TutPosStart_wax_car").transform.position;
                CleaningCloth cc = GameObject.Find("Tools/CleaningCloth").GetComponent <CleaningCloth>();

                string[] names = cc.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                if (names.Length > 0)
                {
                    int ind = Mathf.FloorToInt(Random.Range(0, names.Length));
                    if (GameObject.Find(names[ind]) != null)
                    {
                        endPos             = GameObject.Find(names[ind]).transform.position + new Vector3(.5f, -.5f, 0);
                        transform.position = startPos;
                        StartPointing();
                        StartCoroutine("MovePoinnter");
                    }
                }
            }
            break;

        case "polisher":
            if (GameObject.Find("TutPosStart_polisher") != null)
            {
                startPos = GameObject.Find("TutPosStart_polisher").transform.position;
                Polisher pol = GameObject.Find("Tools/Polisher").GetComponent <Polisher>();

                string[] names = pol.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                if (names.Length > 0)
                {
                    int ind = Mathf.FloorToInt(Random.Range(0, names.Length));
                    if (GameObject.Find(names[ind]) != null)
                    {
                        endPos             = GameObject.Find(names[ind]).transform.position + new Vector3(.5f, -.5f, 0);
                        transform.position = startPos;
                        StartPointing();
                        StartCoroutine("MovePoinnter");
                    }
                }
            }
            break;

        case "inflate_tires":
            if (GameObject.Find("TutPosStart_inflate_tires") != null)
            {
                startPos = GameObject.Find("TutPosStart_inflate_tires").transform.position;
                TirePump tp = GameObject.Find("Tools/TirePump").GetComponent <TirePump>();

                string[] names = tp.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                if (names.Length > 0)
                {
                    int ind = Mathf.FloorToInt(Random.Range(0, names.Length));
                    if (GameObject.Find(names[ind] + "/Valwe") != null)
                    {
                        endPos             = GameObject.Find(names[ind] + "/Valwe").transform.position + new Vector3(.5f, -.5f, 0);
                        transform.position = startPos;
                        StartPointing();
                        StartCoroutine("MovePoinnter");
                    }
                }
            }
            break;


        case "fuel":
            if (GameObject.Find("TutPosStart_fuel") != null)
            {
                startPos           = GameObject.Find("TutPosStart_fuel").transform.position;
                endPos             = GameObject.Find("FuelTank").transform.position + new Vector3(.5f, -.5f, 0);
                transform.position = startPos;
                StartPointing();
                StartCoroutine("MovePoinnter");
            }
            break;


        default: break;
        }
    }
コード例 #14
0
 private void Start()
 {
     WaterGun = GetComponent <WaterGun>();
     Player   = GameObject.FindGameObjectWithTag("Player").transform;
 }
コード例 #15
0
    void Start()
    {
//		tutorial = GameObject.Find("Tutorial").GetComponent<Tutorial>();
        Shop.Instance.txtDispalyStars = null;

        starsCleanLeaves     = 0;
        starsCleanBranches   = 0;
        starsCleanDirt       = 0;
        starsCleanStains     = 0;
        starsCleanWheelBrush = 0;
        starsBubbles         = 0;
        starsRotatingBrush   = 0;
        starsWaxCar          = 0;
        starsPolishCar       = 0;
        starsInflateTires    = 0;
        starsFuel            = 0;



        Vector3 scale = Vector3.one;        // * Screen.width*3f/(4f*Screen.height);

        bubblesHolder     = GameObject.Find("CAR/Bubbles").transform;
        RotatingBrush     = GameObject.Find("RotatingBrush2").transform;
        animRotatingBrush = RotatingBrush.GetChild(0).GetComponent <Animator>();



        GasPump            = GameObject.Find("GasPump").transform;
        GasPump.localScale = scale;
        FuelTank           = GameObject.Find("FuelTank").transform;

        TirePump            = GameObject.Find("Tools/TirePump").transform;
        TirePump.localScale = scale;


        //waterHose = GameObject.Find("Tools/WaterHose").transform;
        //waterHose.localScale = scale;

        cleningCloth            = GameObject.Find("Tools/CleaningCloth").transform;
        cleningCloth.localScale = scale;

        sponge            = GameObject.Find("Tools/Sponge").transform;
        sponge.localScale = scale;


        wheelBrush            = GameObject.Find("Tools/WheelBrush").transform;
        wheelBrush.localScale = scale;

        leafBlower            = GameObject.Find("Tools/LeafBlower").transform;
        leafBlower.localScale = scale;

        shears            = GameObject.Find("Tools/Shears").transform;
        shears.localScale = new Vector3(-scale.x, scale.y, scale.z);

        polisher            = GameObject.Find("Tools/Polisher").transform;
        polisher.localScale = scale;



        waterGun  = GameObject.Find("Tools2/Compressor/WaterGun").GetComponent <WaterGun>();
        waterHose = GameObject.Find("Tools2/WaterHose/Nozzle").GetComponent <WaterHose>();

        DisableAllTools();


        LevelTransition.Instance.ShowScene();
        LevelTransition.bFirstStart = false;
    }