Пример #1
0
 // Start is called before the first frame update
 void Awake()
 {
     target        = GameObject.FindGameObjectWithTag("Player").transform;
     terr          = GameObject.FindGameObjectWithTag("MainTerrain").GetComponent <Terrain>();
     manipTerr     = GameObject.FindGameObjectWithTag("ManipulationTerrain").GetComponent <Terrain>();
     rb            = GetComponent <Rigidbody>();
     lungeTimer    = 0;
     lungingTimer  = 0;
     wanderTimer   = 0;
     randomDir     = Random.onUnitSphere.normalized;
     attackElement = Attacks.AtkDefElement.Scissors;
     attackType    = (Attacks.AttackType)Random.Range(0, 3);
     defenseType   = (DefenseType)(Random.Range(0, 3));
     attackTimer   = 0;
     this.RefreshAttackTimers();
     attackTime = Random.Range(attackTimeMin, attackTimeMax);
     //  attackObject = transform.Find("AttackObject").gameObject;
     attackObjectControl = attackObject.GetComponent <DoAttacking>();
     attackObjRenderer   = attackObject.GetComponent <Renderer>();
     sightRange          = Random.Range(300f, 450f);
     isAlive             = true;
 }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        Application.targetFrameRate = 50;

        mainCam          = Camera.main;
        cameraBounds     = mainCam.transform.parent;
        defaultCamBounds = cameraBounds.transform.localPosition - transform.forward;
        camRotation      = mainCam.transform.localRotation;
        //   mainCamFollow = mainCam.GetComponent<followPlayer>();
        player             = GameObject.FindGameObjectWithTag("PlayerModel").transform;
        isGrounded         = false;
        playerAnim         = player.GetComponent <Animator>();
        rb                 = GetComponent <Rigidbody>();
        terr               = GameObject.FindGameObjectWithTag("MainTerrain").GetComponent <Terrain>();
        manipulatorTerrain = GameObject.FindGameObjectWithTag("ManipulationTerrain").GetComponent <Terrain>();
        SetTerrainCoordinates();
        jumpedTimer                = 0;
        flyFactor                  = flySpeed;
        isJumping                  = false;
        width                      = 3;
        height                     = 3;
        attackTimer                = 0;
        isAttacking                = false;
        attackObjRenderer          = attackObject.GetComponent <Renderer>();
        defenseMatRenderer         = GameObject.FindGameObjectWithTag("PlayerMat").GetComponent <Renderer>();
        attackObjectControl        = attackObject.GetComponent <DoAttacking>();
        attackObjectControl.source = this.transform;
        maxHp                      = 279;
        hp       = maxHp;
        maxDmg   = 2.7f;
        dmgValue = maxDmg;
        isAlive  = true;

        lockOn       = false;
        lockonTarget = null;
        AttackRanges = new float[3, 3] {
            { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }
        };                                                                                       // How far it goes
        AttackTimers = new float[3, 3] {
            { 1, 1, 1 }, { .5f, .75f, .45f }, { 1.5f, 1.45f, 1.65f }
        };                                                                                                  // How soon it can be triggered
        AttackDmgMults = new float[3, 3] {
            { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }
        };                                                                                                  // How much it does
        AttackSpeeds = new float[3, 3] {
            { 2, 2, 2 }, { 3, 3, 3 }, { .5f, .5f, .5f }
        };                                                                                               // How fast it moves
        XPGainAmt = new float[3, 3] {
            { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }
        };
        XP = new float[3] {
            0, 0, 0
        };
        XPLevelThreshold = new float[3] {
            100, 100, 100
        };
        levels = new int[3] {
            0, 0, 0
        };
        totalLevel        = 0;
        miningLight.color = new Color(248f / 255f, 211f / 255f, 167f / 255f);
        defenseParts.Play();
    }