Inheritance: MonoBehaviour
Exemple #1
0
    void Awake()
    {
        if (brench == null )
            brench = GetComponent<SpriteRenderer>();
        if (mask == null)
            mask = GetComponentInChildren<SpriteRenderer>();
        if (follow == null )
            follow = GetComponent<FollowCharacter>();

        if (type == MaskType.Middle)
        {

            int layer = brench.sortingOrder;
            mask.sortingOrder = layer +1;
            float gray = Mathf.Lerp(0.9f, 0.4f, 1.0f * (6-layer) / 6f );
            mask.color = new Color(gray,gray,gray);
            follow.followRate = Mathf.Lerp(0.2f, 0f, 1.0f * (6-layer) / 6f ) + Random.Range(-0.02f, 0.02f);
        }

        if (type == MaskType.Fore)
        {
            int layer = brench.sortingOrder;
            mask.sortingOrder = layer +1;
            float gray = Mathf.Lerp(0.2f, 0.5f, 1.0f * (22-layer) / 2f );
            mask.color = new Color(gray,gray,gray);
            follow.followRate = Mathf.Lerp(-6f, -2f, 1.0f * (22-layer) / 2f ) + Random.Range(-0.5f, 0.5f);
        }
        if (type == MaskType.Back)
        {
            int layer = brench.sortingOrder;
            mask.sortingOrder = layer +1;
            float gray = Mathf.Lerp(0.2f, 0.05f, 1.0f * (-9f-layer) / 4f );
            mask.color = new Color(gray,gray,gray);
            follow.followRate = Mathf.Lerp(0.4f, 0.5f, 1.0f * (-10f-layer) / 2f ) + Random.Range(-0.03f, 0.03f);
        }

        if (isRandomSprite)
        {
            // brench.sprite = brenchSpriteList[Random.Range(0, brenchSpriteList.Length)];
            mask.sprite = MaskSpreiteList[Random.Range(0, MaskSpreiteList.Length)];
            Vector3 scale = mask.transform.localScale;
            if (Random.Range(0, 2) == 1 )
                scale.x *= -1f;
            mask.transform.localScale = scale;
        }

        swapStartTime = Random.Range(0, 1000f);
        swapScale = Random.Range(0.4f, 1.2f);
        if (isRandScale)
        {
        float ranScale = Random.Range(0.9f, 1.05f);
        transform.localScale = transform.localScale * ranScale;
        }
    }
 void Start()
 {
     first = true;
     cam   = Camera.main.GetComponent <FollowCharacter>();
     if (gameObject.tag == "Player 2")
     {
         StrPower      += " 2";
         StrHorizontal += " 2";
         StrJump       += " 2";
         StrGrab       += " 2";
         StrHab        += " 2";
     }
     Anim = GetComponent <Animator>();
 }
Exemple #3
0
    private void Start()
    {
        if (FloatingText != null)
        {
            scaleText = FloatingText.transform.localScale;
            FloatingText.GetComponent <TextMesh>().text = MaxAmmo.ToString();
        }
        cam   = Camera.main.GetComponent <FollowCharacter>();
        first = true;
        recoverytimedespawn = TimeForDespawn;

        WhatissolidGranade = LayerMask.GetMask("Player");
        Whatissolid        = LayerMask.GetMask("Player", "Platform");

        Ammo = MaxAmmo;
    }
    // Use this for initialization
    void Start()
    {
        currentbackgroundSprite = currentBackground.GetComponent <SpriteRenderer>();
        anim = gameObject.GetComponent <Animator>();

        CameraReference = FindObjectOfType <FollowCharacter>();
        spriteWidth     = GetComponent <SpriteRenderer>().bounds.max.x - GetComponent <SpriteRenderer>().bounds.min.x;
        spriteHeight    = GetComponent <SpriteRenderer>().bounds.max.y - GetComponent <SpriteRenderer>().bounds.min.y;
        SimonBody       = GetComponent <Rigidbody2D>();

        SimonSprite        = GetComponent <SpriteRenderer>();
        whipHitbox         = GetComponentsInChildren <BoxCollider2D>()[1];
        whipHitbox.enabled = false;
        myEngine           = GetComponent <PlatformerCharacter2D>();
        lookingRight       = myEngine.m_FacingRight;
    }
Exemple #5
0
 private void Start()
 {
     myTargetCamera = GameObject.Find("TargetCamera").GetComponent <FollowCharacter>();
 }